os: don't wrap os.Getgroups error in tests

The error returned is an os.PathError which already provides enough
context.

Change-Id: Ib9391c00afc56bca673b8086d5dc19cf9b99b285
Reviewed-on: https://go-review.googlesource.com/c/go/+/658957
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Kir Kolyshkin 2025-03-18 16:33:22 -07:00 committed by Gopher Robot
parent 03cb8d408e
commit b59b0580a1
2 changed files with 7 additions and 7 deletions

View file

@ -64,7 +64,7 @@ func TestChown(t *testing.T) {
// Then try all the auxiliary groups.
groups, err := Getgroups()
if err != nil {
t.Fatalf("getgroups: %s", err)
t.Fatal(err)
}
t.Log("groups: ", groups)
for _, g := range groups {
@ -112,7 +112,7 @@ func TestFileChown(t *testing.T) {
// Then try all the auxiliary groups.
groups, err := Getgroups()
if err != nil {
t.Fatalf("getgroups: %s", err)
t.Fatal(err)
}
t.Log("groups: ", groups)
for _, g := range groups {
@ -170,7 +170,7 @@ func TestLchown(t *testing.T) {
// Then try all the auxiliary groups.
groups, err := Getgroups()
if err != nil {
t.Fatalf("getgroups: %s", err)
t.Fatal(err)
}
t.Log("groups: ", groups)
for _, g := range groups {

View file

@ -30,7 +30,7 @@ func TestRootChown(t *testing.T) {
groups, err := os.Getgroups()
if err != nil {
t.Fatalf("getgroups: %v", err)
t.Fatal(err)
}
groups = append(groups, os.Getgid())
for _, test := range rootTestCases {
@ -66,7 +66,7 @@ func TestRootLchown(t *testing.T) {
groups, err := os.Getgroups()
if err != nil {
t.Fatalf("getgroups: %v", err)
t.Fatal(err)
}
groups = append(groups, os.Getgid())
for _, test := range rootTestCases {
@ -97,7 +97,7 @@ func TestRootConsistencyChown(t *testing.T) {
}
groups, err := os.Getgroups()
if err != nil {
t.Fatalf("getgroups: %v", err)
t.Fatal(err)
}
var gid int
if len(groups) == 0 {
@ -133,7 +133,7 @@ func TestRootConsistencyLchown(t *testing.T) {
}
groups, err := os.Getgroups()
if err != nil {
t.Fatalf("getgroups: %v", err)
t.Fatal(err)
}
var gid int
if len(groups) == 0 {