go-spew icon indicating copy to clipboard operation
go-spew copied to clipboard

No longer go gettable with go 1.11 and `GO111MODULE=on` inside $GOPATH

Open zshift opened this issue 6 years ago • 2 comments

Repro steps

> echo $GO111MODULE
on
> pwd
(subdir of GOPATH)
> go get -u github.com/davecgh/go-spew/spew
go: finding github.com/davecgh/go-spew/spew latest
go get github.com/davecgh/go-spew/spew: no matching versions for query "latest"

zshift avatar Oct 21 '18 14:10 zshift

~~I don't think you can use GO111MODULE=on inside a GOPATH workspace, can you? I think GO111MODULE=on is allowed only outside of GOPATH, and GO111MODULE=off or GO111MODULE=auto are allowed inside.~~

Edit: Never mind, it seems valid to use GO111MODULE=on inside a GOPATH workspace according to https://github.com/golang/go/wiki/Modules#how-to-define-a-module.

dmitshur avatar Oct 21 '18 19:10 dmitshur

Works for me:

> pwd
[subdir of $GOPATH]
> go version
go version go1.14.3 freebsd/amd64
> go env GOMOD
[no output, e.g. no go.mod found]
> env GO111MODULE=on go env GOMOD
/dev/null
> env GO111MODULE=on go get -u github.com/davecgh/go-spew/spew
go: found github.com/davecgh/go-spew/spew in github.com/davecgh/go-spew v1.1.1

dchapes avatar May 28 '20 11:05 dchapes