Installation
$ go install code.google.com/p/go.tools/cmd/godoc
Verify Installation
$ godoc fmt Println
func Println(a ...interface{}) (n int, err error)
Println formats using the default formats for its operands and writes to
standard output. Spaces are always added between operands and a newline
is appended. It returns the number of bytes written and any write error
encountered.
Compilation Errors?
If you see errors like the following when running the go install command...darwin amd64 go1.2.1 X:none] expected [darwin amd64 go1.2.2 X:none
... Then, you probably have go object files laying around that were compiled under an older version of go.
So, delete them:
$ echo $GOPATH
/Users/lex/dev/go
$ rm -rf $GOPATH/{bin,pkg}
... Now, re-run your go install code.google.com/p/go.tools/cmd/godoc command.
Warning
Before running the rm -rf command always be careful and verify what you are doing.Command Not Found
In go 1.2.x, godoc is installed in $GOROOT/bin. So, if you installed Go through Homebrew your GOROOT will be in your /usr/local/Cellar/go/<VERISION>/libexec directory, so it add that to your $PATH.~/.bashrc
Configure GOROOT, GOPATH and PATH in ~/.bashrc
export GOPATH=$HOME/dev/go
export GOROOT=`go env GOROOT`
export PATH=$PATH:$GOROOT/bin
References
http://lexsheehan.blogspot.com/2014/07/golang-development-via-ide.htmlThis work is licensed under the Creative Commons Attribution 3.0 Unported License.
No comments:
Post a Comment