Skip to content

dev: consistent version #5817

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

Merged
merged 1 commit into from
May 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmd/golangci-lint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"cmp"
"fmt"
"os"
"regexp"
"runtime/debug"
"strings"

"github.com/golangci/golangci-lint/v2/pkg/commands"
"github.com/golangci/golangci-lint/v2/pkg/exitcodes"
Expand All @@ -23,7 +25,7 @@ func main() {
info := createBuildInfo()

if err := commands.Execute(info); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed executing command with error: %v\n", err)
_, _ = fmt.Fprintf(os.Stderr, "The command is terminated due to an error: %v\n", err)
os.Exit(exitcodes.Failure)
}
}
Expand All @@ -49,6 +51,11 @@ func createBuildInfo() commands.BuildInfo {

info.Version = buildInfo.Main.Version

matched, _ := regexp.MatchString(`v\d+\.\d+\.\d+`, buildInfo.Main.Version)
if matched {
info.Version = strings.TrimPrefix(buildInfo.Main.Version, "v")
}

var revision string
var modified string
for _, setting := range buildInfo.Settings {
Expand Down
Loading