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

x/website/tour: installing @latest gets older version #47236

Open
dmitshur opened this issue Jul 16, 2021 · 3 comments
Open

x/website/tour: installing @latest gets older version #47236

dmitshur opened this issue Jul 16, 2021 · 3 comments

Comments

@dmitshur
Copy link
Contributor

@dmitshur dmitshur commented Jul 16, 2021

A reasonable way to install the latest version of the tour binary from its latest location is by using go install:

go install golang.org/x/website/tour@latest

However, doing so currently gets a slightly older version of the tour, before the x/website/tour nested module was merged into the x/website module in CL 323897.


$ go install golang.org/x/website/tour@latest
go: downloading golang.org/x/website v0.0.0-20210715154925-11adafea15f8
go: downloading golang.org/x/website/tour v0.0.0-20210616181959-e0d934b43647

$ go version -m $(which tour) | head -n 3
/Users/dmitshur/go/bin/tour: go1.16.6
	path	golang.org/x/website/tour
	mod	golang.org/x/website/tour	v0.0.0-20210616181959-e0d934b43647	h1:IFK+1/z6bm51XIJD3ksijCgwsZXJJxliWFiIYVEG6F8=

Note that module path is golang.org/x/website/tour and version is a month-old v0.0.0-20210616181959-e0d934b43647, rather than the latest commit on master branch:

$ go install golang.org/x/website/tour@HEAD
$ go version -m $(which tour) | head -n 3  
/Users/dmitshur/go/bin/tour: go1.16.6
	path	golang.org/x/website/tour
	mod	golang.org/x/website	v0.0.0-20210715154925-11adafea15f8	h1:xRFLa1Fo4NnOCH0yKaPu6H36MmmA/GJEZyTEO+HOWlI=

A workaround is to specify @HEAD or the exact version of tour one wants.

@dmitshur
Copy link
Contributor Author

@dmitshur dmitshur commented Jul 16, 2021

Hmm, this doesn't seem to happen in GOPROXY=direct mode, so maybe the module mirror is playing a role. I'll check again later.

Loading

@dmitshur dmitshur self-assigned this Jul 16, 2021
@dmitshur
Copy link
Contributor Author

@dmitshur dmitshur commented Jul 16, 2021

I understand why this is happening and can confirm both the go command and module mirror are working as expected. Specifically, https://golang.org/ref/mod#resolve-pkg-mod specifies that:

If one or more modules contain the requested package, the module with the longest path is used.

When the module mirror is used, the latest versions of both x/website and x/website/tour modules are found, both contain the tour package, and the x/website/tour with the its longer module path gets selected (despite being older).

I suspect we'll need to fix this by publishing a newer version of the x/website/tour module that retracts its past versions and/or deletes the tour package.

Loading

@bcmills
Copy link
Member

@bcmills bcmills commented Jul 16, 2021

#39007 is closely related.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants