Skip to content

Commit bc52135

Browse files
committed
move the go compiler version to go.version
1 parent a0af5d1 commit bc52135

File tree

4 files changed

+56
-22
lines changed

4 files changed

+56
-22
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,24 @@ jobs:
1717
runs-on: ubuntu-latest
1818

1919
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
23+
- name: Read go.version
24+
run: |
25+
echo "GO_VERSION=$(cat go.version)" >> $GITHUB_ENV
26+
2027
- name: Set up Go 1.x
2128
uses: actions/setup-go@v3
2229
with:
23-
go-version: 1.23.10
30+
go-version: ${{ env.GO_VERSION }}
2431
id: go
2532

2633
- name: Setup Node.js environment
2734
uses: actions/setup-node@v3
2835
with:
2936
node-version: 18
3037

31-
- name: Check out code into the Go module directory
32-
uses: actions/checkout@v3
33-
3438
- name: Ensure all platforms can be built
3539
run: make platform-all
3640

@@ -47,20 +51,24 @@ jobs:
4751
runs-on: ubuntu-latest
4852

4953
steps:
54+
- name: Checkout code
55+
uses: actions/checkout@v3
56+
57+
- name: Read go.version
58+
run: |
59+
echo "GO_VERSION=$(cat go.version)" >> $GITHUB_ENV
60+
5061
- name: Set up Go 1.x
5162
uses: actions/setup-go@v3
5263
with:
53-
go-version: 1.23.10
64+
go-version: ${{ env.GO_VERSION }}
5465
id: go
5566

5667
- name: Setup Node.js environment
5768
uses: actions/setup-node@v3
5869
with:
5970
node-version: 16
6071

61-
- name: Check out code into the Go module directory
62-
uses: actions/checkout@v3
63-
6472
# Note: These tests break with node version 18. Something about WebAssembly.
6573
- name: Rollup Tests
6674
run: make test-rollup
@@ -79,10 +87,23 @@ jobs:
7987
os: [ubuntu-latest, macos-latest, windows-latest]
8088

8189
steps:
90+
- name: Checkout code
91+
uses: actions/checkout@v3
92+
93+
- name: Read go.version (non-Windows)
94+
if: matrix.os != 'windows-latest'
95+
run: |
96+
echo "GO_VERSION=$(cat go.version)" >> $GITHUB_ENV
97+
98+
- name: Read go.version (Windows)
99+
if: matrix.os == 'windows-latest'
100+
run: |
101+
echo "GO_VERSION=$(cat go.version)" >> $Env:GITHUB_ENV
102+
82103
- name: Set up Go 1.x
83104
uses: actions/setup-go@v3
84105
with:
85-
go-version: 1.23.10
106+
go-version: ${{ env.GO_VERSION }}
86107
id: go
87108

88109
- name: Setup Node.js environment
@@ -95,9 +116,6 @@ jobs:
95116
with:
96117
deno-version: v1.40.0
97118

98-
- name: Check out code into the Go module directory
99-
uses: actions/checkout@v3
100-
101119
- name: go test
102120
run: go test -race ./internal/...
103121

@@ -207,15 +225,15 @@ jobs:
207225
runs-on: ubuntu-latest
208226

209227
steps:
228+
- name: Checkout code
229+
uses: actions/checkout@v3
230+
210231
- name: Set up Go 1.13 (the minimum required Go version for esbuild)
211232
uses: actions/setup-go@v3
212233
with:
213234
go-version: 1.13
214235
id: go
215236

216-
- name: Check out code into the Go module directory
217-
uses: actions/checkout@v3
218-
219237
- name: go build
220238
run: go build ./cmd/esbuild
221239

@@ -271,10 +289,23 @@ jobs:
271289
os: [ubuntu-latest, windows-latest]
272290

273291
steps:
292+
- name: Checkout code
293+
uses: actions/checkout@v3
294+
295+
- name: Read go.version (non-Windows)
296+
if: matrix.os != 'windows-latest'
297+
run: |
298+
echo "GO_VERSION=$(cat go.version)" >> $GITHUB_ENV
299+
300+
- name: Read go.version (Windows)
301+
if: matrix.os == 'windows-latest'
302+
run: |
303+
echo "GO_VERSION=$(cat go.version)" >> $Env:GITHUB_ENV
304+
274305
- name: Set up Go 1.x
275306
uses: actions/setup-go@v3
276307
with:
277-
go-version: 1.23.10
308+
go-version: ${{ env.GO_VERSION }}
278309
id: go
279310

280311
# Make sure esbuild works with old versions of Deno. Note: It's important
@@ -284,9 +315,6 @@ jobs:
284315
with:
285316
deno-version: v1.24.0
286317

287-
- name: Check out code into the Go module directory
288-
uses: actions/checkout@v3
289-
290318
- name: Deno Tests (non-Windows)
291319
if: matrix.os != 'windows-latest'
292320
run: make test-deno

.github/workflows/validate.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ jobs:
1515
- name: Checkout code
1616
uses: actions/checkout@v3
1717

18+
- name: Read go.version
19+
run: |
20+
echo "GO_VERSION=$(cat go.version)" >> $GITHUB_ENV
21+
1822
- name: Set up Go 1.x
1923
uses: actions/setup-go@v3
2024
with:
21-
go-version: 1.23.10
25+
go-version: ${{ env.GO_VERSION }}
2226
id: go
2327

2428
- name: Validation checks

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
ESBUILD_VERSION = $(shell cat version.txt)
2+
GO_VERSION = $(shell cat go.version)
23

34
# Strip debug info
45
GO_FLAGS += "-ldflags=-s -w"
@@ -20,7 +21,7 @@ test-all:
2021
@$(MAKE) --no-print-directory -j6 test-common test-deno ts-type-tests test-wasm-node test-wasm-browser lib-typecheck test-yarnpnp
2122

2223
check-go-version:
23-
@go version | grep ' go1\.23\.10 ' || (echo 'Please install Go version 1.23.10' && false)
24+
@go version | grep -F " go$(GO_VERSION) " || (echo 'Please install Go version $(GO_VERSION)' && false)
2425

2526
# Note: Don't add "-race" here by default. The Go race detector is currently
2627
# only supported on the following configurations:
@@ -50,7 +51,7 @@ fmt-go:
5051

5152
no-filepath:
5253
@! grep --color --include '*.go' -r '"path/filepath"' cmd internal pkg || ( \
53-
echo 'error: Use of "path/filepath" is disallowed. See http://golang.org/issue/43768.' && false)
54+
echo 'error: Use of "path/filepath" is disallowed. See https://golang.org/issue/43768' && false)
5455

5556
# This uses "env -i" to run in a clean environment with no environment
5657
# variables. It then adds some environment variables back as needed.

go.version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.23.10

0 commit comments

Comments
 (0)