]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: check for errors from filepath.Glob
authorwangjianwen <wjw1758548031@163.com>
Tue, 11 Apr 2023 02:44:55 +0000 (02:44 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 12 Apr 2023 14:08:29 +0000 (14:08 +0000)
Change-Id: Ib5bcd3d1e9618d65b4d4b0895d0e40dbd76646c6
GitHub-Last-Rev: 174084ca6c67ff99a4b3628d213b2de198f74dd0
GitHub-Pull-Request: golang/go#59516
Reviewed-on: https://go-review.googlesource.com/c/go/+/483435
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/dist/build.go

index a76c312709111a47159f7f607fb75964b1776c3f..6dbc9951a96ff1d86c7b246b20bd2ea37668aa2c 100644 (file)
@@ -1452,7 +1452,10 @@ func cmdbootstrap() {
        bootstrapBuildTools()
 
        // Remember old content of $GOROOT/bin for comparison below.
-       oldBinFiles, _ := filepath.Glob(pathf("%s/bin/*", goroot))
+       oldBinFiles, err := filepath.Glob(pathf("%s/bin/*", goroot))
+       if err != nil {
+               fatalf("glob: %v", err)
+       }
 
        // For the main bootstrap, building for host os/arch.
        oldgoos = goos
@@ -1592,7 +1595,11 @@ func cmdbootstrap() {
 
        // Check that there are no new files in $GOROOT/bin other than
        // go and gofmt and $GOOS_$GOARCH (target bin when cross-compiling).
-       binFiles, _ := filepath.Glob(pathf("%s/bin/*", goroot))
+       binFiles, err := filepath.Glob(pathf("%s/bin/*", goroot))
+       if err != nil {
+               fatalf("glob: %v", err)
+       }
+
        ok := map[string]bool{}
        for _, f := range oldBinFiles {
                ok[f] = true