Only link release URL for published version tags#23
Merged
Conversation
The --version and version output appended a GitHub releases/tag URL for any non-"dev" version, so snapshot ("X.Y.Z-next") and go-install pseudo-version builds printed a link to a tag that does not exist. Gate the URL on a clean semver match instead, mirroring the release check in the Makefile.
There was a problem hiding this comment.
Pull request overview
Tightens the version-output release URL logic so that only clean semver releases produce a GitHub tag link, avoiding 404s for snapshot and pseudo-version builds.
Changes:
- Replace
dev/v-prefix special-casing with a strict^X.Y.Z$regex gate. - Add
TestVersionDisplay_ReleaseURLcovering release, snapshot, pseudo-version, and dev cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/root.go | Replace conditional URL logic with regex match for clean semver and prepend v unconditionally. |
| cmd/version_test.go | Add table-driven test verifying URL inclusion across version shapes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
emailable version/--versionappended a GitHubreleases/tag/<v>URL for any version that wasn't literallydev. Two real build paths produce a non-dev, non-release version and so printed a link to a tag that doesn't exist:make release-snapshot0.3.0-next(fromversion_template).../tag/v0.3.0-next→ 404go install …@<branch>.../tag/v0.3.1-0.2026…→ 404Local
make build(dev) and official GoReleaser releases were already correct.Fix
Gate the URL on a strict semver match (
^[0-9]+\.[0-9]+\.[0-9]+$), the same shapemake releaseenforces. Only a published tag gets a link; snapshot, pseudo-version, and dev builds omit it. The olddev/v-prefix special-casing drops out.Test
TestVersionDisplay_ReleaseURLcovers release / snapshot / pseudo-version / dev. Verified the four cases against real binaries built with the matching ldflags.