From 75032ad8cfac4aefbacd17b47346ac8c1b5ff33f Mon Sep 17 00:00:00 2001 From: Mark Rushakoff Date: Thu, 8 Oct 2020 02:12:43 +0000 Subject: [PATCH] cmd/go: break after terminal loop condition MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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: 6d0c19341b7a85d507c3ec4967bab5f83b0fad8d GitHub-Pull-Request: golang/go#41859 Reviewed-on: https://go-review.googlesource.com/c/go/+/260638 Reviewed-by: Daniel Martí Reviewed-by: Bryan C. Mills Trust: Daniel Martí Run-TryBot: Daniel Martí TryBot-Result: Go Bot --- 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 b5a48558fa..557e418921 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 } } } -- 2.48.1