@@ -30,7 +30,7 @@ import (
30
30
"golang.org/x/tools/go/buildutil"
31
31
)
32
32
33
- type BuildConfig struct {
33
+ type buildConfig struct {
34
34
Name string
35
35
Envs []string
36
36
Flags []string
@@ -235,16 +235,16 @@ type run struct {
235
235
diagnostics map [diagnosticDescriptor ]diagnostic
236
236
}
237
237
238
- func runFromLintResult (res LintResult ) run {
238
+ func runFromLintResult (res lintResult ) run {
239
239
out := run {
240
240
checkedFiles : map [string ]struct {}{},
241
241
diagnostics : map [diagnosticDescriptor ]diagnostic {},
242
242
}
243
243
244
- for _ , cf := range res .CheckedFiles {
244
+ for _ , cf := range res .checkedFiles {
245
245
out .checkedFiles [cf ] = struct {}{}
246
246
}
247
- for _ , diag := range res .Diagnostics {
247
+ for _ , diag := range res .diagnostics {
248
248
out .diagnostics [diag .descriptor ()] = diag
249
249
}
250
250
return out
@@ -253,7 +253,7 @@ func runFromLintResult(res LintResult) run {
253
253
func decodeGob (br io.ByteReader ) ([]run , error ) {
254
254
var runs []run
255
255
for {
256
- var res LintResult
256
+ var res lintResult
257
257
if err := gob .NewDecoder (br .(io.Reader )).Decode (& res ); err != nil {
258
258
if err == io .EOF {
259
259
break
@@ -383,7 +383,7 @@ func (cmd *Command) Run() {
383
383
cmd .exit (2 )
384
384
}
385
385
386
- var bconfs []BuildConfig
386
+ var bconfs []buildConfig
387
387
if cmd .flags .matrix {
388
388
if cmd .flags .tags != "" {
389
389
fmt .Fprintln (os .Stderr , "cannot use -matrix and -tags together" )
@@ -401,7 +401,7 @@ func (cmd *Command) Run() {
401
401
os .Exit (2 )
402
402
}
403
403
} else {
404
- bc := BuildConfig {}
404
+ bc := buildConfig {}
405
405
if cmd .flags .tags != "" {
406
406
// Validate that the tags argument is well-formed. go/packages
407
407
// doesn't detect malformed build flags and returns unhelpful
@@ -420,20 +420,20 @@ func (cmd *Command) Run() {
420
420
var runs []run
421
421
for _ , bconf := range bconfs {
422
422
res , err := doLint (cs , cmd .flags .fs .Args (), & options {
423
- BuildConfig : bconf ,
424
- LintTests : cmd .flags .tests ,
425
- GoVersion : string (cmd .flags .goVersion ),
426
- Config : config.Config {
423
+ buildConfig : bconf ,
424
+ lintTests : cmd .flags .tests ,
425
+ goVersion : string (cmd .flags .goVersion ),
426
+ config : config.Config {
427
427
Checks : cmd .flags .checks ,
428
428
},
429
- PrintAnalyzerMeasurement : measureAnalyzers ,
429
+ printAnalyzerMeasurement : measureAnalyzers ,
430
430
})
431
431
if err != nil {
432
432
fmt .Fprintln (os .Stderr , err )
433
433
cmd .exit (1 )
434
434
}
435
435
436
- for _ , w := range res .Warnings {
436
+ for _ , w := range res .warnings {
437
437
fmt .Fprintln (os .Stderr , "warning:" , w )
438
438
}
439
439
@@ -453,18 +453,18 @@ func (cmd *Command) Run() {
453
453
}
454
454
455
455
if cmd .flags .formatter == "binary" {
456
- for i , s := range res .CheckedFiles {
457
- res .CheckedFiles [i ] = relPath (s )
456
+ for i , s := range res .checkedFiles {
457
+ res .checkedFiles [i ] = relPath (s )
458
458
}
459
- for i := range res .Diagnostics {
459
+ for i := range res .diagnostics {
460
460
// We turn all paths into relative, /-separated paths. This is to make -merge work correctly when
461
461
// merging runs from different OSs, with different absolute paths.
462
462
//
463
463
// We zero out Offset, because checkouts of code on different OSs may have different kinds of
464
464
// newlines and thus different offsets. We don't ever make use of the Offset, anyway. Line and
465
465
// column numbers are precomputed.
466
466
467
- d := & res .Diagnostics [i ]
467
+ d := & res .diagnostics [i ]
468
468
d .Position .Filename = relPath (d .Position .Filename )
469
469
d .Position .Offset = 0
470
470
d .End .Filename = relPath (d .End .Filename )
@@ -498,7 +498,7 @@ func mergeRuns(runs []run) []diagnostic {
498
498
var relevantDiagnostics []diagnostic
499
499
for _ , r := range runs {
500
500
for _ , diag := range r .diagnostics {
501
- switch diag .MergeIf {
501
+ switch diag .mergeIf {
502
502
case lint .MergeIfAny :
503
503
relevantDiagnostics = append (relevantDiagnostics , diag )
504
504
case lint .MergeIfAll :
@@ -557,8 +557,8 @@ func (cmd *Command) printDiagnostics(cs []*lint.Analyzer, diagnostics []diagnost
557
557
if di .Message != dj .Message {
558
558
return di .Message < dj .Message
559
559
}
560
- if di .BuildName != dj .BuildName {
561
- return di .BuildName < dj .BuildName
560
+ if di .buildName != dj .buildName {
561
+ return di .buildName < dj .buildName
562
562
}
563
563
return di .Category < dj .Category
564
564
})
@@ -567,7 +567,7 @@ func (cmd *Command) printDiagnostics(cs []*lint.Analyzer, diagnostics []diagnost
567
567
diagnostics [0 ],
568
568
}
569
569
builds := []map [string ]struct {}{
570
- {diagnostics [0 ].BuildName : {}},
570
+ {diagnostics [0 ].buildName : {}},
571
571
}
572
572
for _ , diag := range diagnostics [1 :] {
573
573
// We may encounter duplicate diagnostics because one file
@@ -576,11 +576,11 @@ func (cmd *Command) printDiagnostics(cs []*lint.Analyzer, diagnostics []diagnost
576
576
if ! filtered [len (filtered )- 1 ].equal (diag ) {
577
577
if filtered [len (filtered )- 1 ].descriptor () == diag .descriptor () {
578
578
// Diagnostics only differ in build name, track new name
579
- builds [len (filtered )- 1 ][diag .BuildName ] = struct {}{}
579
+ builds [len (filtered )- 1 ][diag .buildName ] = struct {}{}
580
580
} else {
581
581
filtered = append (filtered , diag )
582
582
builds = append (builds , map [string ]struct {}{})
583
- builds [len (filtered )- 1 ][diag .BuildName ] = struct {}{}
583
+ builds [len (filtered )- 1 ][diag .buildName ] = struct {}{}
584
584
}
585
585
}
586
586
}
@@ -592,7 +592,7 @@ func (cmd *Command) printDiagnostics(cs []*lint.Analyzer, diagnostics []diagnost
592
592
names = append (names , k )
593
593
}
594
594
sort .Strings (names )
595
- filtered [i ].BuildName = strings .Join (names , "," )
595
+ filtered [i ].buildName = strings .Join (names , "," )
596
596
}
597
597
diagnostics = filtered
598
598
}
@@ -643,14 +643,14 @@ func (cmd *Command) printDiagnostics(cs []*lint.Analyzer, diagnostics []diagnost
643
643
if diag .Category == "compile" && cmd .flags .debugNoCompileErrors {
644
644
continue
645
645
}
646
- if diag .Severity == severityIgnored && ! cmd .flags .showIgnored {
646
+ if diag .severity == severityIgnored && ! cmd .flags .showIgnored {
647
647
numIgnored ++
648
648
continue
649
649
}
650
650
if shouldExit [diag .Category ] {
651
651
numErrors ++
652
652
} else {
653
- diag .Severity = severityWarning
653
+ diag .severity = severityWarning
654
654
numWarnings ++
655
655
}
656
656
notIgnored = append (notIgnored , diag )
0 commit comments