如何为模块本地运行godoc?

时间:2020-06-27 14:16:14

标签: go go-modules godoc

我正在尝试为模块在本地运行godoc,但遇到此错误。

在我看来,godoc依赖于go list,但没有以模块友好的方式运行go list

ak/ (master)  godoc -http=localhost:6060
using module mode; GOMOD=/Users/aaron/ak/go.mod
failed to determine the build list of the main module: go command exited unsuccessfully: exit status 1
go list -m: can't compute 'all' using the vendor directory
    (Use -mod=mod or -mod=readonly to bypass.)

1 个答案:

答案 0 :(得分:0)

尝试一下:

GO111MODULE=off godoc

好像有一个持续存在的问题:https://github.com/golang/go/issues/33655

现在,我将其放在我的点文件中:

alias godoc='GO111MODULE=off godoc'