pkg/user: Support 32bit darwin in user package.

master
Harshavardhana 9 years ago
parent e79a73a3f5
commit 42fcb27308
  1. 4
      pkg/user/user.go

@ -39,7 +39,8 @@ func Current() (*user.User, error) {
} }
return &user.User{Uid: "0", Gid: "0", Username: "root", Name: "root", HomeDir: wd}, nil return &user.User{Uid: "0", Gid: "0", Username: "root", Name: "root", HomeDir: wd}, nil
} }
if runtime.GOARCH == "386" && runtime.GOOS == "linux" { if runtime.GOARCH == "386" {
if runtime.GOOS == "linux" || runtime.GOOS == "darwin" {
return &user.User{ return &user.User{
Uid: strconv.Itoa(os.Getuid()), Uid: strconv.Itoa(os.Getuid()),
Gid: strconv.Itoa(os.Getgid()), Gid: strconv.Itoa(os.Getgid()),
@ -48,6 +49,7 @@ func Current() (*user.User, error) {
HomeDir: os.Getenv("HOME"), HomeDir: os.Getenv("HOME"),
}, nil }, nil
} }
}
user, e := user.Current() user, e := user.Current()
if e != nil { if e != nil {
return nil, e return nil, e

Loading…
Cancel
Save