Skip to content

Commit 70c2a2e

Browse files
authored
build: install Go during build (#704)
1 parent 430d67a commit 70c2a2e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

build.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,28 @@ echo Packing...
1515
rm -rf nupkg
1616
dotnet pack -nologo -v quiet Google.Cloud.EntityFrameworkCore.Spanner -o $PWD/nupkg
1717

18+
# Download and install Go
19+
GO_VERSION="1.26.0"
20+
MSI_FILE="go${GO_VERSION}.windows-amd64.msi"
21+
DOWNLOAD_URL="https://go.dev/dl/${MSI_FILE}"
22+
23+
echo "Downloading Go ${GO_VERSION}..."
24+
curl -fL -o "$MSI_FILE" "$DOWNLOAD_URL"
25+
26+
echo "Installing Go silently"
27+
# /i = install, /quiet = no UI, /norestart = don't reboot the machine
28+
msiexec.exe //i "$MSI_FILE" //quiet //norestart
29+
30+
echo "Cleaning up installer file..."
31+
rm "$MSI_FILE"
32+
echo "Installation finished."
33+
34+
echo "Updating PATH for the current script session..."
35+
# Use standard Bash export, converting the C:\ path to a Git Bash /c/ path
36+
export PATH=$PATH:/c/Program\ Files/Go/bin
37+
# Verify that Go is installed and works
38+
go version
39+
1840
echo Building spanner-ado-net...
1941
pushd spanner-ado-net/spanner-ado-net
2042

0 commit comments

Comments
 (0)