Merge pull request #32370 from gjenkins8/gjenkins/darwin_gocritic_lint_fixes

fix: 'gocritic: filepathJoin path seperator' lint error
pull/32364/head
Terry Howe 4 days ago committed by GitHub
commit 7ed8959dc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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))
}

Loading…
Cancel
Save