From 42fcb2730806d03827a2fff47754feaceaa82e93 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 8 Feb 2016 01:13:53 -0800 Subject: [PATCH] pkg/user: Support 32bit darwin in user package. --- pkg/user/user.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkg/user/user.go b/pkg/user/user.go index ee94ef5c3..ea010829a 100644 --- a/pkg/user/user.go +++ b/pkg/user/user.go @@ -39,14 +39,16 @@ func Current() (*user.User, error) { } return &user.User{Uid: "0", Gid: "0", Username: "root", Name: "root", HomeDir: wd}, nil } - if runtime.GOARCH == "386" && runtime.GOOS == "linux" { - return &user.User{ - Uid: strconv.Itoa(os.Getuid()), - Gid: strconv.Itoa(os.Getgid()), - Username: os.Getenv("USER"), - Name: os.Getenv("USER"), - HomeDir: os.Getenv("HOME"), - }, nil + if runtime.GOARCH == "386" { + if runtime.GOOS == "linux" || runtime.GOOS == "darwin" { + return &user.User{ + Uid: strconv.Itoa(os.Getuid()), + Gid: strconv.Itoa(os.Getgid()), + Username: os.Getenv("USER"), + Name: os.Getenv("USER"), + HomeDir: os.Getenv("HOME"), + }, nil + } } user, e := user.Current() if e != nil {