]> Cypherpunks repositories - gostls13.git/commitdiff
os: don't wrap os.Getgroups error in tests
authorKir Kolyshkin <kolyshkin@gmail.com>
Tue, 18 Mar 2025 23:33:22 +0000 (16:33 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 20 Mar 2025 15:15:51 +0000 (08:15 -0700)
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>

src/os/os_unix_test.go
src/os/root_unix_test.go

index 7e7281955badf93f9d0f77ab3420934506fcfa0d..41feaf77e2cea4d1b3e48221815fb5e5942cb39b 100644 (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 {
index 0562af1f5ee84c9a3a54cb36e0b3b689169d1434..b4b37c2be9dea20c2db9bb60f063d09b7c625561 100644 (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 {