From 01b435a426ba6016e0d481d83a936cdc58b2be61 Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Thu, 24 Apr 2025 17:35:13 +0300 Subject: [PATCH] Enable usetesting linter Signed-off-by: Oleksandr Redko --- .golangci.yml | 3 +++ pkg/limayaml/defaults_test.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 44dcb969..9fe5e678 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -26,6 +26,7 @@ linters: - revive - staticcheck - unused + - usetesting - whitespace settings: depguard: @@ -119,6 +120,8 @@ linters: - -ST1000 - -ST1001 # duplicates revive.dot-imports - -ST1022 + usetesting: + os-temp-dir: true exclusions: presets: - common-false-positives diff --git a/pkg/limayaml/defaults_test.go b/pkg/limayaml/defaults_test.go index b8f20383..9b08ed43 100644 --- a/pkg/limayaml/defaults_test.go +++ b/pkg/limayaml/defaults_test.go @@ -148,7 +148,7 @@ func TestFillDefault(t *testing.T) { Mounts: []Mount{ // Location will be passed through localpathutil.Expand() which will normalize the name // (add a drive letter). So we must start with a valid local path to match it again later. - {Location: filepath.Clean(os.TempDir())}, + {Location: filepath.Clean(t.TempDir())}, {Location: "{{.Dir}}/{{.Param.ONE}}", MountPoint: ptr.Of("/mnt/{{.Param.ONE}}")}, }, MountType: ptr.Of(NINEP),