Search code examples
golinux-mintgodoc

godoc command not found


godoc command doesn't work on my system (I'using Linux Mint 20 Ulyana).

I've just tried this procedure:

  1. install godoc with following command:

go get golang.org/x/tools/cmd/godoc

  1. 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

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?


Solution

  • Add $GOPATH/bin to your PATH variable. Executables, like godoc, are installed to $GOPATH/bin.

    export PATH="$GOPATH/bin:$PATH"
    godoc -http=:6060