Skip to content

Commit 52a0828

Browse files
committed
internal: remove redundant environment variable checks in ConfigDir
os.UserConfigDir will already check the AppData environment variable on Windows (environment variable names are case-insensitive on Windows): https://cs.opensource.google/go/go/+/release-branch.go1.19:src/os/file.go;l=461-465 and the XDG_CONFIG_HOME environment variable on Unix operating systems: https://cs.opensource.google/go/go/+/release-branch.go1.19:src/os/file.go;l=481-489
1 parent b4db245 commit 52a0828

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

internal/internal.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"os"
1111
"os/user"
1212
"path/filepath"
13-
"runtime"
1413
"strconv"
1514
"strings"
1615
)
@@ -26,14 +25,6 @@ func ConfigDir() (string, error) {
2625
return filepath.Join(userConfigDir, "gops"), nil
2726
}
2827

29-
if runtime.GOOS == "windows" {
30-
return filepath.Join(os.Getenv("APPDATA"), "gops"), nil
31-
}
32-
33-
if xdgConfigDir := os.Getenv("XDG_CONFIG_HOME"); xdgConfigDir != "" {
34-
return filepath.Join(xdgConfigDir, "gops"), nil
35-
}
36-
3728
homeDir := guessUnixHomeDir()
3829
if homeDir == "" {
3930
return "", errors.New("unable to get current user home directory: os/user lookup failed; $HOME is empty")

0 commit comments

Comments
 (0)