Skip to content

Commit

Permalink
CI: golangci-lint 1.63
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed Jan 7, 2025
1 parent 57d7247 commit 914228d
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.62
version: v1.63
args: --issues-exit-code=1 --timeout 10m
only-new-issues: false
2 changes: 1 addition & 1 deletion .github/workflows/go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,6 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.62
version: v1.63
args: --issues-exit-code=1 --timeout 10m
only-new-issues: false
2 changes: 1 addition & 1 deletion pkg/apiserver/apic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
func getDBClient(t *testing.T, ctx context.Context) *database.Client {
t.Helper()

dbPath, err := os.CreateTemp("", "*sqlite")
dbPath, err := os.CreateTemp(t.TempDir(), "*sqlite")
require.NoError(t, err)
dbClient, err := database.NewClient(ctx, &csconfig.DatabaseCfg{
Type: "sqlite",
Expand Down
16 changes: 4 additions & 12 deletions pkg/apiserver/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ func LoadTestConfig(t *testing.T) csconfig.Config {
MaxAge: &maxAge,
}

tempDir, _ := os.MkdirTemp("", "crowdsec_tests")

t.Cleanup(func() { os.RemoveAll(tempDir) })
tempDir := t.TempDir()

dbconfig := csconfig.DatabaseCfg{
Type: "sqlite",
Expand Down Expand Up @@ -102,9 +100,7 @@ func LoadTestConfigForwardedFor(t *testing.T) csconfig.Config {
MaxAge: &maxAge,
}

tempDir, _ := os.MkdirTemp("", "crowdsec_tests")

t.Cleanup(func() { os.RemoveAll(tempDir) })
tempDir := t.TempDir()

dbconfig := csconfig.DatabaseCfg{
Type: "sqlite",
Expand Down Expand Up @@ -367,9 +363,7 @@ func TestLoggingDebugToFileConfig(t *testing.T) {
MaxAge: &maxAge,
}

tempDir, _ := os.MkdirTemp("", "crowdsec_tests")

t.Cleanup(func() { os.RemoveAll(tempDir) })
tempDir := t.TempDir()

dbconfig := csconfig.DatabaseCfg{
Type: "sqlite",
Expand Down Expand Up @@ -420,9 +414,7 @@ func TestLoggingErrorToFileConfig(t *testing.T) {
MaxAge: &maxAge,
}

tempDir, _ := os.MkdirTemp("", "crowdsec_tests")

t.Cleanup(func() { os.RemoveAll(tempDir) })
tempDir := t.TempDir()

dbconfig := csconfig.DatabaseCfg{
Type: "sqlite",
Expand Down
8 changes: 2 additions & 6 deletions pkg/csplugin/listfiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ import (
)

func TestListFilesAtPath(t *testing.T) {
dir, err := os.MkdirTemp("", "test-listfiles")
require.NoError(t, err)
t.Cleanup(func() {
os.RemoveAll(dir)
})
_, err = os.Create(filepath.Join(dir, "notification-gitter"))
dir := t.TempDir()
_, err := os.Create(filepath.Join(dir, "notification-gitter"))
require.NoError(t, err)
_, err = os.Create(filepath.Join(dir, "slack"))
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/exprhelpers/exprlib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const TestFolder = "tests"
func getDBClient(t *testing.T) *database.Client {
t.Helper()

dbPath, err := os.CreateTemp("", "*sqlite")
dbPath, err := os.CreateTemp(t.TempDir(), "*sqlite")
require.NoError(t, err)

ctx := context.Background()
Expand Down
4 changes: 1 addition & 3 deletions pkg/fflag/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,9 @@ func TestSetFromYaml(t *testing.T) {
}

func TestSetFromYamlFile(t *testing.T) {
tmpfile, err := os.CreateTemp("", "test")
tmpfile, err := os.CreateTemp(t.TempDir(), "test")
require.NoError(t, err)

defer os.Remove(tmpfile.Name())

// write the config file
_, err = tmpfile.WriteString("- experimental1")
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/setup/detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestSetupHelperProcess(t *testing.T) {
func tempYAML(t *testing.T, content string) os.File {
t.Helper()
require := require.New(t)
file, err := os.CreateTemp("", "")
file, err := os.CreateTemp(t.TempDir(), "")
require.NoError(err)

_, err = file.WriteString(dedent.Dedent(content))
Expand Down

0 comments on commit 914228d

Please sign in to comment.