File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ func detectGoVersion() string {
90
90
91
91
// Trims the Go version to keep only M.m.
92
92
// Since Go 1.21 the version inside the go.mod can be a patched version (ex: 1.21.0).
93
+ // The version can also include information which we want to remove (ex: 1.21alpha1)
93
94
// https://go.dev/doc/toolchain#versions
94
95
// This a problem with staticcheck and gocritic.
95
96
func trimGoVersion (v string ) string {
Original file line number Diff line number Diff line change @@ -73,20 +73,22 @@ func (l *Loader) handleGoVersion() {
73
73
74
74
l .cfg .LintersSettings .ParallelTest .Go = l .cfg .Run .Go
75
75
76
- l .cfg .LintersSettings .Gocritic .Go = trimGoVersion (l .cfg .Run .Go )
76
+ trimmedGoVersion := trimGoVersion (l .cfg .Run .Go )
77
+
78
+ l .cfg .LintersSettings .Gocritic .Go = trimmedGoVersion
77
79
if l .cfg .LintersSettings .Gofumpt .LangVersion == "" {
78
80
l .cfg .LintersSettings .Gofumpt .LangVersion = l .cfg .Run .Go
79
81
}
80
82
81
83
// staticcheck related linters.
82
84
if l .cfg .LintersSettings .Staticcheck .GoVersion == "" {
83
- l .cfg .LintersSettings .Staticcheck .GoVersion = trimGoVersion ( l . cfg . Run . Go )
85
+ l .cfg .LintersSettings .Staticcheck .GoVersion = trimmedGoVersion
84
86
}
85
87
if l .cfg .LintersSettings .Gosimple .GoVersion == "" {
86
- l .cfg .LintersSettings .Gosimple .GoVersion = trimGoVersion ( l . cfg . Run . Go )
88
+ l .cfg .LintersSettings .Gosimple .GoVersion = trimmedGoVersion
87
89
}
88
90
if l .cfg .LintersSettings .Stylecheck .GoVersion != "" {
89
- l .cfg .LintersSettings .Stylecheck .GoVersion = trimGoVersion ( l . cfg . Run . Go )
91
+ l .cfg .LintersSettings .Stylecheck .GoVersion = trimmedGoVersion
90
92
}
91
93
}
92
94
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ func NewValidator(m *Manager) *Validator {
17
17
return & Validator {m : m }
18
18
}
19
19
20
- // Validate validates the configuration.
20
+ // Validate validates the configuration by calling all other validators for different
21
+ // sections in the configuration and then some additional linter validation functions.
21
22
func (v Validator ) Validate (cfg * config.Config ) error {
22
23
err := cfg .Validate ()
23
24
if err != nil {
You can’t perform that action at this time.
0 commit comments