How to Learn Go (golang)
Here is a list of tips and tricks I've found while learning Go. I've tried to keep it short on purpose. Maybe they'll help you, too:
- Start with the Tour (do the next two steps also if you want to run the tour locally - see https://github.com/golang/tour)
- Be sure to set up GOPATH correctly - How to Write Go Code and a video
- Install from source.
You can then use 'hg update release' for the release version or 'hg update tip' to get new bugfixes and features (recommended).
- See also the one-pager Learn Go in Y Minutes
Use hgview to browse the source repository.
- Use gitk to browse the source repository. Reading the diffs is educational.
- play.golang.org is the go equivalent of typing 'python' and then just noodling around, but it's better because you can save a snapshot and send the link to someone else.
- x := someFunction() is easy, but if you want to know what type x is while debugging, use fmt.Printf("%#v", something) - (example)
- go fmt your code with the current go-mode.el. More Using Go with Emacs
- Control-\ (backslash) will sent a SIGQUIT to quit your program and dump the stack of all running goroutines.
- New doc tool - "go get code.google.com/p/rspace.cmd/doc"
- Dave Cheney's list of resources for learning Go
- You can easily cross-compile any go program that's pure go (doesn't link to C libs using cgo).
- Use "go vet" and golint
- Nate Finch's tips for newbie gophers.
Books
Videos
More Documentation
Super-Useful Libraries
More Go Reading
Esoterica
- Show escaping variables - "go build -gcflags -m"