1
0
mirror of https://github.com/golang/go synced 2024-11-11 22:50:22 -07:00

cmd/go: break after terminal loop condition

After the first time needCostly is set to true, there is no need to
continue checking the remaining args.

Change-Id: I07171ce50d20e2a917117a0f84c442fe978cb274
GitHub-Last-Rev: 6d0c19341b
GitHub-Pull-Request: golang/go#41859
Reviewed-on: https://go-review.googlesource.com/c/go/+/260638
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Mark Rushakoff 2020-10-08 02:12:43 +00:00 committed by Bryan C. Mills
parent f8376a55b0
commit 75032ad8cf

View File

@ -217,6 +217,7 @@ func runEnv(ctx context.Context, cmd *base.Command, args []string) {
needCostly = true
} else {
needCostly = false
checkCostly:
for _, arg := range args {
switch argKey(arg) {
case "CGO_CFLAGS",
@ -227,6 +228,7 @@ func runEnv(ctx context.Context, cmd *base.Command, args []string) {
"PKG_CONFIG",
"GOGCCFLAGS":
needCostly = true
break checkCostly
}
}
}