Skip to content

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

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

Closed
dmitshur opened this issue Jul 16, 2021 · 7 comments
Closed

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

dmitshur opened this issue Jul 16, 2021 · 7 comments
Assignees
Labels
modules NeedsFix The path to resolution is known, but the work has not been done. Unfortunate website
Milestone

Comments

@dmitshur
Copy link
Contributor

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 dmitshur added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. modules labels Jul 16, 2021
@dmitshur dmitshur added this to the Unreleased milestone Jul 16, 2021
@dmitshur
Copy link
Contributor Author

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.

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

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.

@bcmills
Copy link
Contributor

bcmills commented Jul 16, 2021

#39007 is closely related.

@dmitshur dmitshur removed their assignment Feb 10, 2022
@ericfrederich
Copy link

I guess this is still an issue in 2025.
I can only run a 4 year old version (2021) of the tour locally?
Is there a workaround?

This seems like it would be an important bug but no attention in 4 years?

# go install golang.org/x/website/tour@latest
go: downloading golang.org/x/website v0.0.0-20250219015331-21ca6346b037
# ~/go/bin/tour
2025/02/19 09:15:33 Serving content from /home/ubuntu/go/pkg/mod/golang.org/x/website/tour@v0.0.0-20210616181959-e0d934b43647
2025/02/19 09:15:33 Please open your web browser and visit http://127.0.0.1:3999

@dmitshur
Copy link
Contributor Author

@ericfrederich Yes, there is a workaround, as mentioned in the original report:

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

For example, go run golang.org/x/website/tour@v0.0.0-20250219015331-21ca6346b037 runs a recent version of tour:

$ go run golang.org/x/website/tour@v0.0.0-20250226202246-0620964c30c6 
2025/02/26 16:55:40 A browser window should open. If not, please visit http://127.0.0.1:3999
[…]

That said, I agree this bug is unfortunate and would be good to fix since beginners are less likely to discover that there is a workaround.

CC @golang/tools-team via owners.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/653155 mentions this issue: tour: deprecate and retract the nested module

gopherbot pushed a commit to golang/website that referenced this issue Feb 27, 2025

Unverified

No user is associated with the committer email.
It stopped being a nested module and its content was merged into
x/website in CL 323897. It was never intended to be a published
module, rather it happened to be one during earlier development
of x/website.

Because the golang.org/x/website/tour module has a longer path than
the golang.org/x/website module, it gets in the way when trying to
install or run the latest version of the tour command. So, deprecate
and retact all of its versions to fix that.

For golang/go#47236.

Change-Id: I88615fc25cd6531d4650210ca8063c53a68ac81a
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Feb 27, 2025
@dmitshur dmitshur self-assigned this Feb 27, 2025
@dmitshur
Copy link
Contributor Author

dmitshur commented Feb 27, 2025

We've retracted all versions of the unintended x/website/tour module in v0.1.0 (including v0.1.0 itself), so now installing or running the tour with the "@​latest" version query gets the latest version from the x/website module as intended:

$ go install golang.org/x/website/tour@latest
go: downloading golang.org/x/website v0.0.0-20250226202246-0620964c30c6
$ go version -m $(which tour) | head -n 3    
$HOME/go/bin/tour: go1.24.0
	path	golang.org/x/website/tour
	mod	golang.org/x/website	v0.0.0-20250226202246-0620964c30c6	h1:JtlmRtOHMUWcPnv9zPCom6XYsUBjblK9HlmhF7hw7Pk=

Also, https://golang.org/x/website/tour now defaults to displaying documentation for the latest x/website version. (Previously it was displaying the latest x/website/tour version from 2021 by default.)

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modules NeedsFix The path to resolution is known, but the work has not been done. Unfortunate website
Projects
None yet
Development

No branches or pull requests

4 participants