AaronKronberg
AaronKronberg

Reputation: 237

How do I run godoc locally for a module?

I'm trying to run godoc locally for a module but running into this error.

It looks to me like godoc relies on go list, but doesn't run go list in a module friendly manner.

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.)

Upvotes: 3

Views: 1671

Answers (1)

Paul
Paul

Reputation: 1242

Try this:

GO111MODULE=off godoc

Looks like there's an ongoing issue with this: https://github.com/golang/go/issues/33655

For now, I've put this in my dotfiles:

alias godoc='GO111MODULE=off godoc'

Upvotes: 2

Related Questions