Skip to content

Commit 3ab0696

Browse files
author
Fayaz
committed
Update workflow to use Go 1.20.15 for bootstrapping per Go docs requirements
1 parent 276f7fb commit 3ab0696

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

.github/workflows/build-and-release.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- name: Setup Go
4444
uses: actions/setup-go@v4
4545
with:
46-
go-version: '1.22.6' # Updated bootstrap version per Go build requirements
46+
go-version: '1.20.15' # The latest in 1.20.x series required for building Go 1.22+
4747
check-latest: true
4848

4949
- name: Verify Go Version
@@ -167,7 +167,7 @@ jobs:
167167
- name: Setup Go
168168
uses: actions/setup-go@v4
169169
with:
170-
go-version: '1.22.6' # Updated bootstrap version per requirements
170+
go-version: '1.20.15' # The latest in 1.20.x series required for building Go 1.22+
171171
check-latest: true
172172

173173
- name: Verify Go Version
@@ -192,8 +192,8 @@ jobs:
192192
cp -f src/cmd/dist/build.go golang-repo/src/cmd/dist/build.go
193193
194194
# Create VERSION file with bootstrap version
195-
echo "go1.22.6" > golang-repo/VERSION
196-
echo "Created VERSION file with bootstrap version go1.22.6"
195+
echo "go1.20.15" > golang-repo/VERSION
196+
echo "Created VERSION file with bootstrap version go1.20.15"
197197
198198
# NOTE: Do not remove go.mod, go.sum, or go.work files – they are required for the build
199199
cd golang-repo
@@ -210,8 +210,8 @@ jobs:
210210
Copy-Item -Force src\cmd\dist\build.go golang-repo\src\cmd\dist\build.go
211211
212212
# Create VERSION file with bootstrap version
213-
Set-Content -Path "golang-repo\VERSION" -Value "go1.22.6"
214-
Write-Host "Created VERSION file with bootstrap version go1.22.6"
213+
Set-Content -Path "golang-repo\VERSION" -Value "go1.20.15"
214+
Write-Host "Created VERSION file with bootstrap version go1.20.15"
215215
216216
# NOTE: Do not remove go.mod, go.sum, or go.work files
217217
cd golang-repo
@@ -234,7 +234,12 @@ jobs:
234234
cd golang-repo
235235
236236
# Ensure the VERSION file is set
237-
echo "go1.22.6" > VERSION
237+
echo "go1.20.15" > VERSION
238+
239+
# Fix go.mod files to work with our bootstrap version if needed
240+
find . -name "go.mod" -exec sed -i.bak 's/go 1\.[2-9][0-9]/go 1.20/' {} \;
241+
find . -name "go.mod" -exec grep -l "go 1." {} \; | xargs -r cat
242+
echo "Modified go.mod files to ensure compatibility with Go 1.20 bootstrap"
238243
239244
# Build Go using the official procedure
240245
cd src
@@ -274,7 +279,15 @@ jobs:
274279
cd golang-repo
275280
276281
# Ensure the VERSION file is set
277-
Set-Content -Path "VERSION" -Value "go1.22.6"
282+
Set-Content -Path "VERSION" -Value "go1.20.15"
283+
284+
# Fix go.mod files to work with our bootstrap version if needed
285+
Get-ChildItem -Path . -Recurse -Filter "go.mod" | ForEach-Object {
286+
(Get-Content $_.FullName) -replace 'go 1\.[2-9][0-9]', 'go 1.20' | Set-Content $_.FullName
287+
Write-Host "Checking file: $($_.FullName)"
288+
Get-Content $_.FullName | Select-String "go 1."
289+
}
290+
Write-Host "Modified go.mod files to ensure compatibility with Go 1.20 bootstrap"
278291
279292
# Build Go using the official documentation
280293
cd src

0 commit comments

Comments
 (0)