From bdcb80ee633a57b1b6276825cc358ceb5116323a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 20 May 2023 17:11:41 +0100 Subject: [PATCH] adapt to tip's error message change from "GOROOT" to "std" --- .github/workflows/test.yml | 2 +- shared.go | 3 +++ testdata/script/help.txtar | 3 ++- testdata/script/list_error.txtar | 10 ++++++++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e8b2a4..3bb5b54 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -91,7 +91,7 @@ jobs: steps: - name: Install Go env: - GO_COMMIT: acd8dc95833182df86831ec78e7470864bdb3b88 # 2023-05-12 + GO_COMMIT: aeb0644bd33e67f24e2411a651ac9ff72ddc96b4 # 2023-05-19 run: | cd $HOME mkdir $HOME/gotip diff --git a/shared.go b/shared.go index 062b0dd..54f4957 100644 --- a/shared.go +++ b/shared.go @@ -285,7 +285,10 @@ func appendListedPackages(packages []string, mainBuild bool) error { // like "arena", so older Go versions that we support // do not yet have them and that's OK. // Note that pkg.Standard is false for them. + // Note that Go 1.21 is swapping "GOROOT" for "std". + // TODO(mvdan): We try to list test packages like runtime/metrics_test, which always fail. case strings.Contains(perr.Err, "is not in GOROOT"): + case strings.Contains(perr.Err, "is not in std"): case strings.Contains(perr.Err, "cannot find package"): } } diff --git a/testdata/script/help.txtar b/testdata/script/help.txtar index a6e982a..56cfc5a 100644 --- a/testdata/script/help.txtar +++ b/testdata/script/help.txtar @@ -78,7 +78,8 @@ stderr 'must precede command, like: garble -seed=random build \./pkg' stderr 'did you run.*instead of "garble \[command\]"' ! exec garble build badpackage -stderr 'package badpackage is not in GOROOT' +[!go1.21] stderr 'package badpackage is not in GOROOT' +[go1.21] stderr 'package badpackage is not in std' ! stdout . ! exec garble build ./badpackage diff --git a/testdata/script/list_error.txtar b/testdata/script/list_error.txtar index bdc2697..228d189 100644 --- a/testdata/script/list_error.txtar +++ b/testdata/script/list_error.txtar @@ -1,11 +1,17 @@ ! exec garble build ./... -cmpenv stderr stderr.golden +[!go1.21] cmpenv stderr stderr-go1.20.golden +[go1.21] cmpenv stderr stderr-go1.21.golden --- stderr.golden -- +-- stderr-go1.20.golden -- # test/main/broken broken${/}broken.go:5:16: cannot use 123 (untyped int constant) as string value in variable declaration # test/main/imports_missing package test/main/missing is not in GOROOT (${GOROOT}${/}src${/}test${/}main${/}missing) +-- stderr-go1.21.golden -- +# test/main/broken +broken${/}broken.go:5:16: cannot use 123 (untyped int constant) as string value in variable declaration +# test/main/imports_missing +package test/main/missing is not in std (${GOROOT}${/}src${/}test${/}main${/}missing) -- go.mod -- module test/main