Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/doc: doc doesn't work in module mode #27239

Closed
rocket049 opened this issue Aug 26, 2018 · 3 comments
Closed

go/doc: doc doesn't work in module mode #27239

rocket049 opened this issue Aug 26, 2018 · 3 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@rocket049
Copy link

What version of Go are you using (go version)?

go version go1.11 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/fhz8/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/fhz8/golang"
GOPROXY=""
GORACE=""
GOROOT="/opt/go1.11"
GOTMPDIR=""
GOTOOLDIR="/opt/go1.11/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="g/home/fhz8/src/color1/o.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build921500593=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I move source files outside of the gopath.
In directory:
/home/fhz8/src/color1/

edit go.mod:

module color1

require (
	github.com/gookit/color v1.1.3
	github.com/gookit/config v1.0.8
	github.com/xioxu/goreq v1.0.3-alpha
)

then run: /opt/go1.11/bin/go mod download

next run: /opt/go1.11/bin/go doc github.com/gookit/color

it output:

doc: no such package github.com/gookit/color
exit status 1

What did you expect to see?

It must show the document of the package color.

What did you see instead?

it output:

doc: no such package github.com/gookit/color
exit status 1
@myitcv myitcv added the modules label Aug 26, 2018
@ALTree ALTree changed the title "go doc" can't work correct under module mode. go/doc: doc doesn't work in module mode Aug 26, 2018
@FiloSottile FiloSottile added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 30, 2018
@FiloSottile FiloSottile added this to the Go1.12 milestone Aug 30, 2018
@trico
Copy link
Contributor

trico commented Sep 2, 2018

@rocket049 go doc uses the go executable to check if your are using modules or GOPATH. Please run go version without /opt/go1.11/bin/. I'm sure you must have a version < 1.11

@rocket049
Copy link
Author

rocket049 commented Sep 3, 2018

@trico you are right. i remove go1.10, then go1.11 work correct.

@agnivade
Copy link
Contributor

agnivade commented Sep 3, 2018

Seems like this is resolved.

@agnivade agnivade closed this as completed Sep 3, 2018
@golang golang locked and limited conversation to collaborators Sep 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants