-1

I've run into a very strange issue, and even though I'm sure the solution is simple, but I can't find anything online about this. Trying to use go doc <args...> for any set of arguments always results in the error:

go tool: no such tool "doc"

despite doc showing up in the command output for go help and go help doc providing documentation of and usage for go doc.

What's going on here? I even tried downloading the tar.gz bundle from golang.org because I figured maybe the version I installed with pacman was bad, but the unzipped go also had the same issue (with, of course, a properly altered GOPATH).

Asalle
  • 1,239
  • 19
  • 41
rookie1024
  • 612
  • 7
  • 18
  • 2
    "Trying to use go doc for any set of arguments" You could be doing anything! Give specific examples. Questions seeking debugging help ("why isn't this code [command] working?") must include the desired behavior, a specific problem or error and the shortest code [command] necessary to reproduce it in the question itself. – peterSO Jan 08 '19 at 04:24
  • 1
    Remove all your Go installations and install as described from golang.org. – Volker Jan 08 '19 at 05:33
  • Can you find the "$GOROOT/bin/godoc" bin file? Try to run "which godoc". The command "go doc" is actually calling the "godoc" I believe, some package manager just not install them fully, or forget to set some more ENV var. – nvcnvn Jan 08 '19 at 07:13
  • 3
    @nvcnvn The command "go doc" runs the command "doc" in the tool exec dir, not the "godoc" command. – Charlie Tumahai Jan 08 '19 at 07:49
  • I use go on arch linux and have never had this problem. I suspect something in your environment is messed up. – AKstat Jan 08 '19 at 11:55
  • @peterSO `go doc` doesn't work, that's the minimum example. The command I was trying to run is `go doc "regex/syntax"`, but regardless of the parameters I pass to `go doc`, I get the same error, which is why I did not provide any specific usage. – rookie1024 Jan 09 '19 at 23:30
  • @Volker As I mentioned in the question, grabbing the gz file with the preinstalled binaries from golang.org and setting $GOPATH to point to its unzipped location (which is, in effect, their recommended installation method) resulted in the same error. – rookie1024 Jan 09 '19 at 23:33
  • @peterSO I made a typo, but it should be "regexp/syntax," as stated by this page: https://golang.org/pkg/regexp/ – rookie1024 Jan 09 '19 at 23:54

1 Answers1

1

The problem was caused by the fact that my system version of go was gccgo v1.10.3 - installing go v1.11.4 resolved the issue.

rookie1024
  • 612
  • 7
  • 18