File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 1
1
package shareddefaults
2
2
3
3
import (
4
+ "os/user"
4
5
"path/filepath"
5
6
)
6
7
@@ -29,5 +30,17 @@ func SharedConfigFilename() string {
29
30
// UserHomeDir returns the home directory for the user the process is
30
31
// running under.
31
32
func UserHomeDir () string {
32
- return userHomeDir ()
33
+ var home string
34
+
35
+ home = userHomeDir ()
36
+ if len (home ) > 0 {
37
+ return home
38
+ }
39
+
40
+ currUser , _ := user .Current ()
41
+ if currUser != nil {
42
+ home = currUser .HomeDir
43
+ }
44
+
45
+ return home
33
46
}
Original file line number Diff line number Diff line change @@ -5,20 +5,9 @@ package shareddefaults
5
5
6
6
import (
7
7
"os"
8
- "os/user"
9
8
)
10
9
11
10
func userHomeDir () string {
12
11
home , _ := os .UserHomeDir ()
13
-
14
- if len (home ) > 0 {
15
- return home
16
- }
17
-
18
- currUser , _ := user .Current ()
19
- if currUser != nil {
20
- home = currUser .HomeDir
21
- }
22
-
23
12
return home
24
13
}
You can’t perform that action at this time.
0 commit comments