godoc command doesn't work on my system (I'using Linux Mint 20 Ulyana).
I've just tried this procedure:
go get golang.org/x/tools/cmd/godoc
godoc -http=:6060
The result is:
bash: godoc: command not found
I'm using this go version go version go1.15 linux/amd64
And this is my PATH variable /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/go/bin
All other go commands (go build, go run and so on) work correctly.
What can I do to make godoc command work?
install godoc with following command: go get golang.org/x/tools/cmd/godoc. Start godoc server: godoc -http=:6060. The result is: bash: godoc: command not found. I'm using this go version go version go1.15 linux/amd64. ...
The source code for GoDoc is available on GitHub. GoDoc displays documentation for GOOS=linux unless otherwise noted at the bottom of the documentation page. If you want to lookup some package’s documents in command line, you should install the go tool at first.
Godoc is conceptually related to Python’s Docstring and Java’s Javadoc but its design is simpler. The comments read by godoc are not language constructs (as with Docstring) nor must they have their own machine-readable syntax (as with Javadoc). Godoc comments are just good comments, the sort you would want to read even if godoc didn’t exist.
The comments read by godoc are not language constructs (as with Docstring) nor must they have their own machine-readable syntax (as with Javadoc). Godoc comments are just good comments, the sort you would want to read even if godoc didn’t exist.
Make sure you can run godoc using this command:
$GOPATH/bin/godoc -http=:6060
If you don't see any error then go to Step - 4 else if you can see this error No such file or directory
then you have to get the godoc package first by using this command:
go get golang.org/x/tools/cmd/godoc
It will take some time to install.
Try this command
godoc --help
if this command ran successfully then you are done and nothing else to do else if you are still getting any errors follow the Step - 4 and if you still fail please check if you have defined the $GOPATH
variable correctly
Add $GOPATH/bin to your PATH variable by using this command:
export PATH="$GOPATH/bin:$PATH"
Try Step - 3 now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With