os/user: use the stubs fallback for Android

Using the stubs, user.Current will no longer fail on Android, fixing
the os/exec.TestCredentialNoSetGroups test.

Change-Id: I8b9842aa6704c0cde383c549a614bab0a0ed7695
Reviewed-on: https://go-review.googlesource.com/37765
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Elias Naur 2017-03-04 04:55:56 +01:00
parent e99dafc4a8
commit 143fd8ef2a
2 changed files with 4 additions and 14 deletions

View File

@ -8,15 +8,6 @@ package user
import "errors"
func init() {
userImplemented = false
groupImplemented = false
}
func current() (*User, error) {
return nil, errors.New("user: Current not implemented on android")
}
func lookupUser(string) (*User, error) {
return nil, errors.New("user: Lookup not implemented on android")
}
@ -32,7 +23,3 @@ func lookupGroup(string) (*Group, error) {
func lookupGroupId(string) (*Group, error) {
return nil, errors.New("user: LookupGroupId not implemented on android")
}
func listGroups(*User) ([]string, error) {
return nil, errors.New("user: GroupIds not implemented on android")
}

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !cgo,!windows,!plan9,!android
// +build !cgo,!windows,!plan9 android
package user
@ -46,6 +46,9 @@ func current() (*User, error) {
}
func listGroups(*User) ([]string, error) {
if runtime.GOOS == "android" {
return nil, errors.New("user: GroupIds not implemented on Android")
}
return nil, errors.New("user: GroupIds requires cgo")
}