Skip to content

Commit 1c222b4

Browse files
authored
dev: consistent version (#5817)
1 parent 48d1da4 commit 1c222b4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cmd/golangci-lint/main.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import (
44
"cmp"
55
"fmt"
66
"os"
7+
"regexp"
78
"runtime/debug"
9+
"strings"
810

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

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

5052
info.Version = buildInfo.Main.Version
5153

54+
matched, _ := regexp.MatchString(`v\d+\.\d+\.\d+`, buildInfo.Main.Version)
55+
if matched {
56+
info.Version = strings.TrimPrefix(buildInfo.Main.Version, "v")
57+
}
58+
5259
var revision string
5360
var modified string
5461
for _, setting := range buildInfo.Settings {

0 commit comments

Comments
 (0)