Skip to content

Commit

Permalink
os/user: simplify skipping listGroups test
Browse files Browse the repository at this point in the history
This is not implemented on AIX and Illumos, and we already have a
mechanism to skip the test case -- let's use it.

Change-Id: Idb1cc2d716cf6d0731e93dfc3aa7853b9edec41f
Reviewed-on: https://go-review.googlesource.com/c/go/+/330752
Reviewed-by: Tobias Klauser <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Run-TryBot: Tobias Klauser <[email protected]>
TryBot-Result: Go Bot <[email protected]>
  • Loading branch information
kolyshkin authored and tklauser committed Aug 28, 2021
1 parent 6df3aac commit f4cd001
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/os/user/listgroups_aix.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ package user

import "fmt"

// Not implemented on AIX, see golang.org/issue/30563.

func init() {
groupListImplemented = false
}

func listGroups(u *User) ([]string, error) {
return nil, fmt.Errorf("user: list groups for %s: not supported on AIX", u.Username)
}
6 changes: 6 additions & 0 deletions src/os/user/listgroups_illumos.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ package user

import "fmt"

// Not implemented on illumos, see golang.org/issue/14709.

func init() {
groupListImplemented = false
}

func listGroups(u *User) ([]string, error) {
return nil, fmt.Errorf("user: list groups for %s: not supported on illumos", u.Username)
}
7 changes: 0 additions & 7 deletions src/os/user/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package user

import (
"runtime"
"testing"
)

Expand Down Expand Up @@ -128,12 +127,6 @@ func checkGroupList(t *testing.T) {

func TestGroupIds(t *testing.T) {
checkGroupList(t)
if runtime.GOOS == "aix" {
t.Skip("skipping GroupIds, see golang.org/issue/30563")
}
if runtime.GOOS == "illumos" {
t.Skip("skipping GroupIds, see golang.org/issue/14709")
}
user, err := Current()
if err != nil {
t.Fatalf("Current(): %v", err)
Expand Down

0 comments on commit f4cd001

Please sign in to comment.