Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 3864e76

Browse files
committed
On plan9, prefer lowercase "home" env var
1 parent ddd64a0 commit 3864e76

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

homedir.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,14 @@ func Expand(path string) (string, error) {
7777
}
7878

7979
func dirUnix() (string, error) {
80+
homeEnv := "HOME"
81+
if runtime.GOOS == "plan9" {
82+
// On plan9, env vars are lowercase.
83+
homeEnv = "home"
84+
}
85+
8086
// First prefer the HOME environmental variable
81-
if home := os.Getenv("HOME"); home != "" {
87+
if home := os.Getenv(homeEnv); home != "" {
8288
return home, nil
8389
}
8490

0 commit comments

Comments
 (0)