File tree 2 files changed +9
-5
lines changed
testdata/src/default_config/cgo 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -86,9 +86,13 @@ func (wa *wslAnalyzer) run(pass *analysis.Pass) (any, error) {
86
86
continue
87
87
}
88
88
89
- // if the file is related to cgo the filename of the unadjusted position is a not a '.go' file.
90
89
fn := pass .Fset .PositionFor (file .Pos (), false ).Filename
91
90
91
+ // if the file is related to cgo the filename of the unadjusted position is a not a '.go' file.
92
+ if ! strings .HasSuffix (fn , ".go" ) {
93
+ continue
94
+ }
95
+
92
96
// The file is skipped if the "unadjusted" file is a Go file, and it's a generated file (ex: "_test.go" file).
93
97
// The other non-Go files are skipped by the first 'if' with the adjusted position.
94
98
if ! wa .config .IncludeGenerated && ast .IsGenerated (file ) && strings .HasSuffix (fn , ".go" ) {
Original file line number Diff line number Diff line change @@ -22,16 +22,16 @@ func _() {
22
22
23
23
func Advanced () {
24
24
var foo = 1
25
- var bar = 2 // want "declarations should never be cuddled"
26
- var biz int // want "declarations should never be cuddled"
25
+ var bar = 2
26
+ var biz int
27
27
28
28
x := []string {}
29
29
x = append (x , "literal" )
30
30
notUsed := "just assigning, don't mind me"
31
- x = append (x , "not z.." ) // want "append only allowed to cuddle with appended value"
31
+ x = append (x , "not z.." )
32
32
useMe := "right away"
33
33
alsoNotUsed := ":("
34
- x = append (x , "just noise" ) // want "append only allowed to cuddle with appended value"
34
+ x = append (x , "just noise" )
35
35
x = append (x , useMe )
36
36
37
37
_ = foo
You can’t perform that action at this time.
0 commit comments