1. The go doc tool can only retrieve comment content from the ../go/src directory under the Go installation directory. In addition, it can serve as a local documentation browsing web server. Enter godoc -http=:6060 in the command line, then open http://localhost:6060 in a browser, and you will see the page provided by the local documentation browsing server. Reference URL: https://github.com/unknwon/the-way-to-go_ZH_CN/blob/master/eBook/03.6.md
2. Running godoc -http=:6060 in the command line returns an error: “godoc” is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. See Figure 1.

PS C:\Go> godoc -http=:6060
godoc : 无法将“godoc”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正
确,然后再试一次。
所在位置 行:1 字符: 1
+ godoc -http=:6060
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (godoc:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
3. I navigated to the C:\Go\bin directory to check the files and found that godoc.exe does not exist.
PS C:\Go> cd bin
PS C:\Go\bin> ls
目录: C:\Go\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2019/10/31 22:59 14797824 go.exe
-a---- 2019/10/31 22:59 3715072 gofmt.exe
4. I checked the Go version by running the command: go version. Reference URL: https://golang.org/doc/go1.13#godoc . The Godoc web server is no longer included in the main binary distribution. To run the godoc web server locally, you need to install it manually first.
PS C:\Go> go version
go version go1.13.4 windows/amd64
5. go install compiles and installs its own packages and dependencies. I ran go install golang.org/x/tools/cmd/godoc (https://github.com/golang/tools/tree/master/godoc). Reference URL: https://www.shuijingwanwq.com/2019/12/28/3784/ to resolve the error.
PS C:\Go> go install golang.org/x/tools/cmd/godoc
C:\Users\Administrator\go\src\golang.org\x\tools\cmd\godoc\main.go:47:2: cannot find package "golang.org/x/xerrors" in a
ny of:
c:\go\src\golang.org\x\xerrors (from $GOROOT)
C:\Users\Administrator\go\src\golang.org\x\xerrors (from $GOPATH)
PS C:\Go> set HTTP_PROXY=http://127.0.0.1:50999
PS C:\Go> set HTTPS_PROXY=http://127.0.0.1:50999
PS C:\Go> go install golang.org/x/tools/cmd/godoc
go: downloading golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898
go: extracting golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898
6. I ran godoc -http=:6060 in the command line again, and it succeeded.
PS C:\Go> godoc -http=:6060
using GOPATH mode
7. I opened http://localhost:6060 in a browser. It loaded normally, as expected. See Figure 2.

8. I navigated to the C:\Go\bin directory to check the files and found that godoc.exe still does not exist. I then navigated to the C:\Users\Administrator\go\bin directory to check the files and found that godoc.exe already exists, as expected. See Figure 3.

PS C:\Go> cd C:\Go\bin
PS C:\Go\bin> ls
目录: C:\Go\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2019/10/31 22:59 14797824 go.exe
-a---- 2019/10/31 22:59 3715072 gofmt.exe
PS C:\Go\bin> cd C:\Users\Administrator\go\bin
PS C:\Users\Administrator\go\bin> ls
目录: C:\Users\Administrator\go\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2020/02/20 18:17 16660480 godoc.exe
-a---- 2020/02/20 18:34 14633984 tour.exe
