diff options
Diffstat (limited to 'src/pkg/os')
| -rw-r--r-- | src/pkg/os/user/Makefile | 2 | ||||
| -rw-r--r-- | src/pkg/os/user/lookup_unix.go | 4 | ||||
| -rw-r--r-- | src/pkg/os/user/user.go | 2 | ||||
| -rw-r--r-- | src/pkg/os/user/user_test.go | 4 |
4 files changed, 9 insertions, 3 deletions
diff --git a/src/pkg/os/user/Makefile b/src/pkg/os/user/Makefile index 731f7999a..aabb54995 100644 --- a/src/pkg/os/user/Makefile +++ b/src/pkg/os/user/Makefile @@ -8,7 +8,7 @@ TARG=os/user GOFILES=\ user.go\ -ifneq ($(GOARCH),arm) +ifeq ($(CGO_ENABLED),1) CGOFILES_linux=\ lookup_unix.go CGOFILES_freebsd=\ diff --git a/src/pkg/os/user/lookup_unix.go b/src/pkg/os/user/lookup_unix.go index 678de802b..1b2c9e8c9 100644 --- a/src/pkg/os/user/lookup_unix.go +++ b/src/pkg/os/user/lookup_unix.go @@ -25,6 +25,10 @@ static int mygetpwuid_r(int uid, struct passwd *pwd, */ import "C" +func init() { + implemented = true +} + // Lookup looks up a user by username. If the user cannot be found, // the returned error is of type UnknownUserError. func Lookup(username string) (*User, os.Error) { diff --git a/src/pkg/os/user/user.go b/src/pkg/os/user/user.go index dd009211d..f71e11d8b 100644 --- a/src/pkg/os/user/user.go +++ b/src/pkg/os/user/user.go @@ -9,6 +9,8 @@ import ( "strconv" ) +var implemented = false // set to true by lookup_unix.go's init + // User represents a user account. type User struct { Uid int // user id diff --git a/src/pkg/os/user/user_test.go b/src/pkg/os/user/user_test.go index ee917b57a..59f15e4c6 100644 --- a/src/pkg/os/user/user_test.go +++ b/src/pkg/os/user/user_test.go @@ -13,8 +13,8 @@ import ( ) func skip(t *testing.T) bool { - if runtime.GOARCH == "arm" { - t.Logf("user: cgo not implemented on arm; skipping tests") + if !implemented { + t.Logf("user: not implemented; skipping tests") return true } |
