apt-get install golang-go gocode golang-golang-x-tools golint
sudo go get -u github.com/nsf/gocode sudo go get -u github.com/rogpeppe/godef sudo go get -u golang.org/x/tools/cmd/guru
Single GOPATH:
You can have multiple projects in a single GOPATH. Each project will have a main.go in a different package. Often this is the right way to go. All the projects will share the same dependencies, when you upgrade a library each project will be updated. This works well when all the projects are updated and deployed together (like micro services).
GOPATH directory structure:
Example setup of GOPATH:
Edit ~/.bashrc to add the following line:
export GOPATH=$HOME/go
re-login to apply changes.
setpath Download: https://s3.ap-south-1.amazonaws.com/gosetpath/setpath_linux_64
cd ~/project/src setpath go get github.com/golang/example/hello
setpath will automatically set GOPATH to correct path, even if executed deeply inside ~/project subdirs.
To download dep command:
setpath go get -u github.com/golang/dep/cmd/dep
dep reads two files called Gopkg.toml and the Gopkg.lock
Commands: init Set up a new Go project, or migrate an existing one status Report the status of the project's dependencies ensure Ensure a dependency is safely vendored in the project version Show the dep version information check Check if imports, Gopkg.toml, and Gopkg.lock are in sync
cd ~/project/src/github.com/muka/go-bluetooth setpath ${GOPATH}/bin/dep ensure
and new packages will be downloaded to ~/project/src/github.com/muka/go-bluetooth/vendor
GoClipse plugin for Eclipse. Installation: GoClipse installation
go get github.com/rogpeppe/godef go get golang.org/x/tools/cmd/guru
Configure GO plugin:
panic: Can't find the package clause
Probably gocode version mismatch: