Skip to content

update Go, fix, add /@latest to goproxytest#302

Merged
mvdan merged 3 commits into
rogpeppe:masterfrom
mvdan:updates
Apr 15, 2026
Merged

update Go, fix, add /@latest to goproxytest#302
mvdan merged 3 commits into
rogpeppe:masterfrom
mvdan:updates

Conversation

@mvdan

@mvdan mvdan commented Mar 17, 2026

Copy link
Copy Markdown
Collaborator

(see commit messages - please do not squash)

@mvdan mvdan requested a review from myitcv March 17, 2026 14:07

@rogpeppe rogpeppe left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM but I think the version selection criteria aren't quite right.

Comment thread goproxytest/proxy.go Outdated
mvdan added 2 commits April 15, 2026 13:53
Mainly so that gopls is not as noisy when editing files.

@rogpeppe rogpeppe left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo a couple of suggestions below.

Comment thread goproxytest/proxy.go Outdated
Comment thread goproxytest/proxy_test.go Outdated
The Go module proxy protocol defines a $base/$module/@latest endpoint
that returns the .info JSON for the latest version of a module.
The handler only matched paths containing /@v/, so /@latest got a 404.

Add a check for the /@latest suffix before the /@v/ routing.
When matched, find the highest release version, falling back to
pre-release versions if no release exists, and serve its .info file.

The version selection is in a standalone latestVersion function
that takes an iter.Seq[string], following the same algorithm as
cue-lang/cue's LatestVersion in internal/mod/modload/query.go.

The test is a direct HTTP unit test rather than a testscript like
testdata/list.txt because the go command does not expose /@latest
responses to the user; it uses the endpoint internally as a fallback.
There is no go subcommand whose output we could assert on in a script
to verify that /@latest is served correctly.
@mvdan mvdan merged commit a4c00dc into rogpeppe:master Apr 15, 2026
6 checks passed
@mvdan mvdan deleted the updates branch May 27, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants