gobook icon indicating copy to clipboard operation
gobook copied to clipboard

Godoc v. go doc in Go 1.14

Open TomasHubelbauer opened this issue 5 years ago • 0 comments

I am a novice at Go, so this might have an obvious reason/solution, however I have run into a problem on the first page of the book. It says to use godoc hash to read about the hash package. I tried that and it says this:

Unexpected arguments. Use "go doc" for command-line help output instead. For example, "go doc fmt.Printf".
usage: godoc -http=localhost:6060

When using go doc hash, everything works as expected. Should go doc hash be the recommended command to run instead?

I am not sure why the difference in Godoc and go doc. I installed godoc using go get golang.org/x/tools/cmd/godoc which is a command I just got somewhere, I didn't find any "official" way to do it and the highest ranked Google result (some reddit post) contained a command which didn't work for me (it hung). So I settled at this command.

I am using Go 1.14 so it's possible things have changed between when this (and others books and resources I've been using) were written and today.

TomasHubelbauer avatar Mar 12 '20 20:03 TomasHubelbauer