@@ -10,6 +10,7 @@ import (
10
10
"sync"
11
11
12
12
"github.com/BurntSushi/toml"
13
+ hcversion "github.com/hashicorp/go-version"
13
14
reviveConfig "github.com/mgechev/revive/config"
14
15
"github.com/mgechev/revive/lint"
15
16
"github.com/mgechev/revive/rule"
@@ -89,6 +90,11 @@ func newWrapper(settings *config.ReviveSettings) (*wrapper, error) {
89
90
return nil , err
90
91
}
91
92
93
+ conf .GoVersion , err = hcversion .NewVersion (settings .Go )
94
+ if err != nil {
95
+ return nil , err
96
+ }
97
+
92
98
formatter , err := reviveConfig .GetFormatter ("json" )
93
99
if err != nil {
94
100
return nil , err
@@ -183,7 +189,10 @@ func toIssue(pass *analysis.Pass, object *jsonObject) goanalysis.Issue {
183
189
func getConfig (cfg * config.ReviveSettings ) (* lint.Config , error ) {
184
190
conf := defaultConfig ()
185
191
186
- if ! reflect .DeepEqual (cfg , & config.ReviveSettings {}) {
192
+ // Since the Go version is dynamic, this value must be neutralized in order to compare with a "zero value" of the configuration structure.
193
+ zero := & config.ReviveSettings {Go : cfg .Go }
194
+
195
+ if ! reflect .DeepEqual (cfg , zero ) {
187
196
rawRoot := createConfigMap (cfg )
188
197
buf := bytes .NewBuffer (nil )
189
198
@@ -275,7 +284,7 @@ func safeTomlSlice(r []any) []any {
275
284
}
276
285
277
286
// This element is not exported by revive, so we need copy the code.
278
- // Extracted from https://github.com/mgechev/revive/blob/v1.3.7 /config/config.go#L15
287
+ // Extracted from https://github.com/mgechev/revive/blob/v1.3.9 /config/config.go#L15
279
288
var defaultRules = []lint.Rule {
280
289
& rule.VarDeclarationsRule {},
281
290
& rule.PackageCommentsRule {},
@@ -358,6 +367,7 @@ var allRules = append([]lint.Rule{
358
367
& rule.EnforceRepeatedArgTypeStyleRule {},
359
368
& rule.EnforceSliceStyleRule {},
360
369
& rule.MaxControlNestingRule {},
370
+ & rule.CommentsDensityRule {},
361
371
}, defaultRules ... )
362
372
363
373
const defaultConfidence = 0.8
0 commit comments