Skip to content

Commit fff832a

Browse files
committed
tests: clean go1.24 build tags
1 parent 3a00ca1 commit fff832a

File tree

6 files changed

+32
-97
lines changed

6 files changed

+32
-97
lines changed

pkg/golinters/usetesting/testdata/usetesting.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,23 @@
22
package testdata
33

44
import (
5+
"context"
56
"os"
67
"testing"
78
)
89

10+
func Test_contextBackground(t *testing.T) {
11+
context.Background()
12+
}
13+
14+
func Test_contextTODO(t *testing.T) {
15+
context.TODO()
16+
}
17+
18+
func Test_osChdir(t *testing.T) {
19+
os.Chdir("") // want `os\.Chdir\(\) could be replaced by t\.Chdir\(\) in .+`
20+
}
21+
922
func Test_osMkdirTemp(t *testing.T) {
1023
os.MkdirTemp("", "") // want `os\.MkdirTemp\(\) could be replaced by t\.TempDir\(\) in .+`
1124
}

pkg/golinters/usetesting/testdata/usetesting_configuration.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,31 @@
33
package testdata
44

55
import (
6+
"context"
67
"os"
78
"testing"
89
)
910

11+
func Test_contextBackground(t *testing.T) {
12+
context.Background() // want `context\.Background\(\) could be replaced by t\.Context\(\) in .+`
13+
}
14+
15+
func Test_contextTODO(t *testing.T) {
16+
context.TODO() // want `context\.TODO\(\) could be replaced by t\.Context\(\) in .+`
17+
}
18+
19+
func Test_osChdir(t *testing.T) {
20+
os.Chdir("")
21+
}
22+
1023
func Test_osMkdirTemp(t *testing.T) {
1124
os.MkdirTemp("", "")
1225
}
1326

27+
func Test_osSetenv(t *testing.T) {
28+
os.Setenv("", "") // want `os\.Setenv\(\) could be replaced by t\.Setenv\(\) in .+`
29+
}
30+
1431
func Test_osTempDir(t *testing.T) {
1532
os.TempDir() // want `os\.TempDir\(\) could be replaced by t\.TempDir\(\) in .+`
1633
}

pkg/golinters/usetesting/testdata/usetesting_configuration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ linters:
88
os-setenv: true
99
os-temp-dir: true
1010
os-chdir: false
11-
context-background: false
12-
context-todo: false
11+
context-background: true
12+
context-todo: true

pkg/golinters/usetesting/testdata/usetesting_go124.go

Lines changed: 0 additions & 41 deletions
This file was deleted.

pkg/golinters/usetesting/testdata/usetesting_go124_configuration.go

Lines changed: 0 additions & 42 deletions
This file was deleted.

pkg/golinters/usetesting/testdata/usetesting_go124_configuration.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)