From 6d0c19341b7a85d507c3ec4967bab5f83b0fad8d Mon Sep 17 00:00:00 2001 From: Mark Rushakoff Date: Wed, 7 Oct 2020 22:05:28 -0400 Subject: [PATCH] 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. --- src/cmd/go/internal/envcmd/env.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go index 59d0ded658..dde68c1f0c 100644 --- a/src/cmd/go/internal/envcmd/env.go +++ b/src/cmd/go/internal/envcmd/env.go @@ -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 } } }