Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: golangci-lint 1.63 #3396

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading