From 3ac715ed99a9c2a132f42349c825cedf0b9a64ac Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Tue, 5 Sep 2023 10:17:05 -0700 Subject: [PATCH] Build the Go toolchain before applying patches This allows us to use this version of the toolchain to run the `go mod ...` commands, instead of relying on the host toolchain and having to manipulate the Go module version in the new toolchain go.mod file. --- scripts/create-secondary-patch.sh | 4 ++-- scripts/setup-initial-patch.sh | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/create-secondary-patch.sh b/scripts/create-secondary-patch.sh index e8fb612d78..148c2d0ee8 100755 --- a/scripts/create-secondary-patch.sh +++ b/scripts/create-secondary-patch.sh @@ -37,8 +37,8 @@ replace="${1}" if [ -n "${replace}" ]; then echo "replace github.com/golang-fips/openssl-fips => ${replace}" >> go.mod fi -go mod tidy -go mod vendor +../bin/go mod tidy +../bin/go mod vendor # Generate the final patch. git add . diff --git a/scripts/setup-initial-patch.sh b/scripts/setup-initial-patch.sh index f835c0ddd1..b1dab7ecaa 100755 --- a/scripts/setup-initial-patch.sh +++ b/scripts/setup-initial-patch.sh @@ -38,6 +38,12 @@ shift $((OPTIND-1)) cd ./go ORIGINAL_GIT_SHA=$(git rev-parse HEAD) +# Build the Go toolchain before applying patches. This allows us to use this toolchain in later steps +# when running `go mod` commands. +pushd ./src +./make.bash +popd + "${ROOT}"/scripts/apply-initial-patch.sh "${ROOT}"/scripts/create-secondary-patch.sh "${replacement}"