File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
testdata/src/default_config/cgo Expand file tree Collapse file tree 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) {
8686 continue
8787 }
8888
89- // if the file is related to cgo the filename of the unadjusted position is a not a '.go' file.
9089 fn := pass .Fset .PositionFor (file .Pos (), false ).Filename
9190
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+
9296 // The file is skipped if the "unadjusted" file is a Go file, and it's a generated file (ex: "_test.go" file).
9397 // The other non-Go files are skipped by the first 'if' with the adjusted position.
9498 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 _() {
2222
2323func Advanced () {
2424 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
2727
2828 x := []string {}
2929 x = append (x , "literal" )
3030 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.." )
3232 useMe := "right away"
3333 alsoNotUsed := ":("
34- x = append (x , "just noise" ) // want "append only allowed to cuddle with appended value"
34+ x = append (x , "just noise" )
3535 x = append (x , useMe )
3636
3737 _ = foo
You can’t perform that action at this time.
0 commit comments