From: Matthew Dempsky Date: Mon, 20 Sep 2021 21:59:54 +0000 (-0700) Subject: internal/buildcfg: fix test for GOAMD64=v3 ./all.bash X-Git-Tag: go1.18beta1~1280 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d7e3e442febea1d4ba7b6b456f46b2fd9c3b69e6;p=gostls13.git internal/buildcfg: fix test for GOAMD64=v3 ./all.bash If GOAMD64 is set to a bogus value, goamd64() will return the default value, which may not necessarily be 1. Instead, just test that it sets Error. Change-Id: Ibbc26608c1ae24e645c7753ef5765b9c2fdc089e Reviewed-on: https://go-review.googlesource.com/c/go/+/351129 Trust: Matthew Dempsky Run-TryBot: Matthew Dempsky TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor --- diff --git a/src/internal/buildcfg/cfg_test.go b/src/internal/buildcfg/cfg_test.go index 9180441c28..0123593317 100644 --- a/src/internal/buildcfg/cfg_test.go +++ b/src/internal/buildcfg/cfg_test.go @@ -18,8 +18,9 @@ func TestConfigFlags(t *testing.T) { if goamd64() != 4 { t.Errorf("Wrong parsing of GOAMD64=v4") } + Error = nil os.Setenv("GOAMD64", "1") - if goamd64() != 1 { + if goamd64(); Error == nil { t.Errorf("Wrong parsing of GOAMD64=1") } }