Why GO111MODULE=auto go get does not always work?

154 views
Skip to first unread message

Peng Yu

unread,
Feb 24, 2021, 1:41:14 PM2/24/21
to golan...@googlegroups.com
Hi,

`GO111MODULE=auto go get` does not always work. What causes this bug? Thanks.

$ GO111MODULE=auto go get golang.org/x/net/html
$ GO111MODULE=auto go get rsc.io/quote
/Users/xxx/go/src/rsc.io/quote/quote.go:8:8: code in directory
/Users/xxx/go/src/rsc.io/quote/v3 expects import "rsc.io/quote"

--
Regards,
Peng

Shulhan

unread,
Feb 24, 2021, 2:56:30 PM2/24/21
to Peng Yu, golan...@googlegroups.com
https://golang.org/ref/mod#mod-commands

If you run the "go get" command on directory that does not contains "go.mod" file, its basically equal to "GO111MODULE=off go get", without module aware.

Where do you get the above commands? rsc.io/quote is an example of repository to explain of how Go module works and not works if run without Go module-aware.

https://github.com/golang/go/issues/26367

Peng Yu

unread,
Feb 24, 2021, 3:56:18 PM2/24/21
to Shulhan, golan...@googlegroups.com
Hi Shulhan,

> https://golang.org/ref/mod#mod-commands
>
> If you run the "go get" command on directory that does not contains "go.mod"
> file, its basically equal to "GO111MODULE=off go get", without module
> aware.
>
> Where do you get the above commands?

I made them up.

> rsc.io/quote is an example of
> repository to explain of how Go module works and not works if run without Go
> module-aware.
>
> https://github.com/golang/go/issues/26367

So `GO111MODULE=auto go get <pkg>` should work for any other packages
except rsc.io/quote?

--
Regards,
Peng
Reply all
Reply to author
Forward
0 new messages