1
0
mirror of https://github.com/golang/go synced 2024-09-28 21:24:29 -06:00

cmd/dist: check for errors from filepath.Glob

Change-Id: Ib5bcd3d1e9618d65b4d4b0895d0e40dbd76646c6
GitHub-Last-Rev: 174084ca6c
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>
This commit is contained in:
wangjianwen 2023-04-11 02:44:55 +00:00 committed by Gopher Robot
parent de475e8a66
commit 4b154e55ba

11
src/cmd/dist/build.go vendored
View 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