【问题标题】:How do I run godoc locally for a module?如何在本地为模块运行 godoc?
【发布时间】:2020-09-24 00:55:12
【问题描述】:

我正在尝试在本地为模块运行 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.)

【问题讨论】:

  • 到目前为止,这是不可能的。

标签: go go-modules godoc


【解决方案1】:

试试这个:

GO111MODULE=off godoc

看起来这个问题一直存在:https://github.com/golang/go/issues/33655

目前,我已将其放入我的 dotfiles 中:

alias godoc='GO111MODULE=off godoc'

【讨论】:

    猜你喜欢
    • 2021-12-11
    • 2018-08-22
    • 1970-01-01
    • 2018-06-19
    • 2014-08-16
    • 2019-07-22
    • 1970-01-01
    • 2021-05-13
    • 2021-06-06
    相关资源
    最近更新 更多