From 98466a1f64dfc9a3b9d4bb49dcdb2b3a5ff5f245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 20 Dec 2022 12:17:22 +0100 Subject: [PATCH] scripts: use -trimpath for "go build" in check-third-party Since "garble build" first performs a Go build with -trimpath, it helps to also use the flag with the "go build" step. This way we get more build cache hits, as building a Go package with and without the flag results in two separate builds. Before: $ go clean -cache && time ./scripts/check-third-party.sh real 0m41.844s user 2m17.791s sys 0m35.440s After: $ go clean -cache && time ./scripts/check-third-party.sh real 0m33.983s user 1m50.596s sys 0m28.499s --- scripts/check-third-party.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/check-third-party.sh b/scripts/check-third-party.sh index 2fad083..2fce74d 100755 --- a/scripts/check-third-party.sh +++ b/scripts/check-third-party.sh @@ -72,7 +72,8 @@ for ((i = 0; i < ${#modules[@]}; i += 2)); do fi # Run "go build" first, to ensure the regular Go build works. - show go build "${module}/..." + # Use -trimpath to help reuse the cache with "garble build". + show go build -trimpath "${module}/..." # Run the garble build. show garble build "${module}/..."