From 96a25ab4f86c2c78de2acfe45a69c0a40055aa3c Mon Sep 17 00:00:00 2001 From: George Jenkins Date: Wed, 15 Jul 2026 16:48:15 -0700 Subject: [PATCH] fix: 'gocritic: filepathJoin path seperator' lint error Signed-off-by: George Jenkins --- pkg/helmpath/lazypath_darwin_test.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/pkg/helmpath/lazypath_darwin_test.go b/pkg/helmpath/lazypath_darwin_test.go index 143750f04..8d61334f8 100644 --- a/pkg/helmpath/lazypath_darwin_test.go +++ b/pkg/helmpath/lazypath_darwin_test.go @@ -36,13 +36,12 @@ func TestDataPath(t *testing.T) { os.Unsetenv(xdg.DataHomeEnvVar) expected := filepath.Join(homedir.HomeDir(), "Library", appName, testFile) - assert.Equal(t, expected, lazy.dataPath(testFile)) - t.Setenv(xdg.DataHomeEnvVar, "/tmp") - - expected = filepath.Join("/tmp", appName, testFile) + tmpDir := t.TempDir() + t.Setenv(xdg.DataHomeEnvVar, tmpDir) + expected = filepath.Join(tmpDir, appName, testFile) assert.Equal(t, expected, lazy.dataPath(testFile)) } @@ -50,13 +49,12 @@ func TestConfigPath(t *testing.T) { os.Unsetenv(xdg.ConfigHomeEnvVar) expected := filepath.Join(homedir.HomeDir(), "Library", "Preferences", appName, testFile) - assert.Equal(t, expected, lazy.configPath(testFile)) - t.Setenv(xdg.ConfigHomeEnvVar, "/tmp") - - expected = filepath.Join("/tmp", appName, testFile) + tmpDir := t.TempDir() + t.Setenv(xdg.ConfigHomeEnvVar, tmpDir) + expected = filepath.Join(tmpDir, appName, testFile) assert.Equal(t, expected, lazy.configPath(testFile)) } @@ -64,12 +62,11 @@ func TestCachePath(t *testing.T) { os.Unsetenv(xdg.CacheHomeEnvVar) expected := filepath.Join(homedir.HomeDir(), "Library", "Caches", appName, testFile) - assert.Equal(t, expected, lazy.cachePath(testFile)) - t.Setenv(xdg.CacheHomeEnvVar, "/tmp") - - expected = filepath.Join("/tmp", appName, testFile) + tmpDir := t.TempDir() + t.Setenv(xdg.CacheHomeEnvVar, tmpDir) + expected = filepath.Join(tmpDir, appName, testFile) assert.Equal(t, expected, lazy.cachePath(testFile)) }