Skip to content

Commit 5d6e9d7

Browse files
committed
Add test that gofmt and revive work with cgo
Signed-off-by: Sven Anderson <[email protected]>
1 parent 886fbd7 commit 5d6e9d7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

test/run_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ func TestCgoWithIssues(t *testing.T) {
104104
ExpectHasIssue("Printf format %t has arg cs of wrong type")
105105
r.Run("--no-config", "--disable-all", "-Estaticcheck", getTestDataDir("cgo_with_issues")).
106106
ExpectHasIssue("SA5009: Printf format %t has arg #1 of wrong type")
107+
r.Run("--no-config", "--disable-all", "-Egofmt", getTestDataDir("cgo_with_issues")).
108+
ExpectHasIssue("File is not `gofmt`-ed with `-s` (gofmt)")
107109
}
108110

109111
func TestUnsafeOk(t *testing.T) {

test/testdata/cgo_with_issues/main.go

+12
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,15 @@ func Example() {
2121
fmt.Printf("bad format %t", cs)
2222
C.free(unsafe.Pointer(cs))
2323
}
24+
25+
func notFormattedForGofmt() {
26+
}
27+
28+
func errorForRevive(p *int) error {
29+
if p == nil {
30+
return nil
31+
} else {
32+
return nil
33+
}
34+
}
35+

0 commit comments

Comments
 (0)