meta data for this page
  •  

This is an old revision of the document!


Installation

apt-get install golang-go gocode golang-golang-x-tools golint

Edit ~/.bashrc to add the following line:

~/.bashrc
export GOPATH=$HOME/go

re-login to apply changes.

IDE

GoClipse plugin for Eclipse. Installation: GoClipse installation

go get github.com/rogpeppe/godef
go get golang.org/x/tools/cmd/guru

Configure GO plugin:

  • Preferences–>Go–>Tools and setup executables:
    • /usr/bin/gocode
    • /home/user/go/bin/guru
    • /home/user/go/bin/godef
    • /usr/bin/gofmt
  • Preferences–>Go
    • Go installation: Directory /usr

closures

func main() {
  add := func(x, y int) int {
    return x + y
  }
  fmt.Println(add(1,1))
}
func makeEvenGenerator() func() uint {
  i := uint(0)
  return func() (ret uint) {
    ret = i
    i += 2
    return
  }
}