Skip to content

Instantly share code, notes, and snippets.

@daluu
daluu / go_get_private_repos.txt
Last active March 26, 2023 08:51 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.
```bash
$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
```

tldr: go build only produces an executable for main packages. Check the package name of your main file is main.

I am an idiot. Its only through mistakes that you learn tho. I have recently been running into issues with my new golang projects. ONLY the new ones. Whenever I try to make a new project, it would always have issues. The biggest issue is the fact that "go build" would not produce an executable without "-o main.exe" as arguments. When an executable was produced, if I ran it I got

$ ./main.exe
./main.exe: line 1: syntax error near unexpected token \`newline\'
./main.exe: line 1: \`!<arch>\'
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@hyamamoto
hyamamoto / utf8_to_sjis.go
Created February 7, 2015 17:05
ShiftJIS <=> UTF-8 conversion samples in Go language.
package main
import (
"fmt"
"strings"
"bytes"
"io"
"io/ioutil"
"golang.org/x/text/transform"
// "code.google.com/p/go.text/transform" // deprecated