]> Cypherpunks repositories - gostls13.git/commitdiff
os: correct err check in TestChdirAndGetwd
authorTobias Klauser <tklauser@distanz.ch>
Wed, 29 Nov 2017 10:46:48 +0000 (11:46 +0100)
committerTobias Klauser <tobias.klauser@gmail.com>
Wed, 29 Nov 2017 15:53:14 +0000 (15:53 +0000)
Due to err being shadowed in the else brach, the actual err return of
fd1.Chdir() is never checked. Fix it by not shadowing err anymore.

Change-Id: I9f1d52e88d8bc9a1c035960aa7af9f5224a63ab0
Reviewed-on: https://go-review.googlesource.com/80556
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/os/os_test.go

index eb8a7d1b926a24c1be63c65c9c08b3755f807d9f..2d608f4b246706445988d75b0a254ffd0200065f 100644 (file)
@@ -1239,9 +1239,9 @@ func TestChdirAndGetwd(t *testing.T) {
                        if mode == 0 {
                                err = Chdir(d)
                        } else {
-                               fd1, err := Open(d)
-                               if err != nil {
-                                       t.Errorf("Open %s: %s", d, err)
+                               fd1, err1 := Open(d)
+                               if err1 != nil {
+                                       t.Errorf("Open %s: %s", d, err1)
                                        continue
                                }
                                err = fd1.Chdir()