Skip to content

Commit e637ce7

Browse files
committed
chore: new default Go version
1 parent 1741450 commit e637ce7

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.golangci.next.reference.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4182,8 +4182,8 @@ run:
41824182

41834183
# Define the Go version limit.
41844184
# Mainly related to generics support since go1.18.
4185-
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.17
4186-
go: '1.19'
4185+
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.22.
4186+
go: '1.22'
41874187

41884188
# Number of operating system threads (`GOMAXPROCS`) that can execute golangci-lint simultaneously.
41894189
# Default: automatically set to match Linux container CPU quota and

pkg/commands/flagsets.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ func setupRunFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
5050
color.GreenString("Modules download mode. If not empty, passed as -mod=<mode> to go tools"))
5151
internal.AddFlagAndBind(v, fs, fs.Int, "issues-exit-code", "run.issues-exit-code", exitcodes.IssuesFound,
5252
color.GreenString("Exit code when issues were found"))
53-
internal.AddFlagAndBind(v, fs, fs.String, "go", "run.go", "", color.GreenString("Targeted Go version"))
5453
internal.AddHackedStringSlice(fs, "build-tags", color.GreenString("Build tags"))
5554

5655
internal.AddFlagAndBind(v, fs, fs.Duration, "timeout", "run.timeout", defaultTimeout,

pkg/config/config.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ import (
1515
"golang.org/x/mod/modfile"
1616
)
1717

18+
// defaultGoVersion the value should be "oldstable" - 1.
19+
// If the current stable version is 1.24 then 1.23 - 1 = 1.22.
20+
const defaultGoVersion = "1.22"
21+
1822
// Config encapsulates the config data specified in the golangci-lint YAML config file.
1923
type Config struct {
2024
cfgDir string // Path to the directory containing golangci-lint config file.
@@ -93,7 +97,7 @@ func IsGoGreaterThanOrEqual(current, limit string) bool {
9397
}
9498

9599
func detectGoVersion(ctx context.Context) string {
96-
return cmp.Or(detectGoVersionFromGoMod(ctx), "1.17")
100+
return cmp.Or(detectGoVersionFromGoMod(ctx), defaultGoVersion)
97101
}
98102

99103
// detectGoVersionFromGoMod tries to get Go version from go.mod.

0 commit comments

Comments
 (0)