Skip to content

Commit 2b15c1d

Browse files
committed
tests: add cgo files to autofix
1 parent 9ed79a4 commit 2b15c1d

File tree

5 files changed

+88
-3
lines changed

5 files changed

+88
-3
lines changed

pkg/golinters/gofumpt/gofumpt.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ func runGofumpt(lintCtx *linter.Context, pass *analysis.Pass, diff differ, optio
6363
for _, file := range pass.Files {
6464
position := goanalysis.GetFilePosition(pass, file)
6565

66-
if !strings.HasSuffix(position.Filename, ".go") {
67-
continue
68-
}
66+
// if !strings.HasSuffix(position.Filename, ".go") {
67+
// continue
68+
// }
6969

7070
input, err := os.ReadFile(position.Filename)
7171
if err != nil {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//golangcitest:args -Egofumpt
2+
//golangcitest:config_path testdata/gofumpt-fix.yml
3+
//golangcitest:expected_exitcode 0
4+
package p
5+
6+
/*
7+
#include <stdio.h>
8+
#include <stdlib.h>
9+
10+
void myprint(char* s) {
11+
printf("%d\n", s);
12+
}
13+
*/
14+
import "C"
15+
16+
import "fmt"
17+
18+
func GofmtNotExtra(bar string, baz string) {
19+
fmt.Print(bar, baz)
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//golangcitest:args -Egofumpt
2+
//golangcitest:config_path testdata/gofumpt-fix.yml
3+
//golangcitest:expected_exitcode 0
4+
package p
5+
6+
/*
7+
#include <stdio.h>
8+
#include <stdlib.h>
9+
10+
void myprint(char* s) {
11+
printf("%d\n", s);
12+
}
13+
*/
14+
import "C"
15+
16+
import "fmt"
17+
18+
func GofmtNotExtra(bar, baz string) {
19+
fmt.Print(bar, baz)
20+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//golangcitest:args -Egoimports
2+
//golangcitest:expected_exitcode 0
3+
package p
4+
5+
/*
6+
#include <stdio.h>
7+
#include <stdlib.h>
8+
9+
void myprint(char* s) {
10+
printf("%d\n", s);
11+
}
12+
*/
13+
import "C"
14+
15+
import (
16+
"os"
17+
"fmt"
18+
)
19+
20+
func goimports(a, b int) int {
21+
if a != b {
22+
return 1
23+
}
24+
return 2
25+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//golangcitest:args -Egoimports
2+
//golangcitest:expected_exitcode 0
3+
package p
4+
5+
/*
6+
#include <stdio.h>
7+
#include <stdlib.h>
8+
9+
void myprint(char* s) {
10+
printf("%d\n", s);
11+
}
12+
*/
13+
import "C"
14+
15+
func goimports(a, b int) int {
16+
if a != b {
17+
return 1
18+
}
19+
return 2
20+
}

0 commit comments

Comments
 (0)