Skip to content

fix: return only one tag when git tag returns multiple#171

Open
imax9000 wants to merge 1 commit intosourcegraph:mainfrom
imax9000:main
Open

fix: return only one tag when git tag returns multiple#171
imax9000 wants to merge 1 commit intosourcegraph:mainfrom
imax9000:main

Conversation

@imax9000
Copy link
Copy Markdown

@imax9000 imax9000 commented Oct 5, 2025

This makes version inference work correctly on github.com/kubernetes/api, returning just "v0.34.1" instead of "kubernetes-1.34.1\nv0.34.1".

This makes version inference work correctly on github.com/kubernetes/api,
returning just "v0.34.1" instead of "kubernetes-1.34.1\nv0.34.1".
"fmt"
"strings"

"github.com/Masterminds/semver"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use golang.org/x/mod/semver instead

return "", fmt.Errorf("failed to tags for current commit: %v\n%s", err, version)
return "", fmt.Errorf("failed to tags for current commit: %v\n%s", err, tags)
}
lines := strings.Split(tags, "\n")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What happens if tags is empty?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants