fix: checkout repo before setting up go environment (#1390)

sudoforge created

This change ensures that the `go.sum` file used by the
`actions/setup-go` action as the cache identifier exists in the working
tree.

Closes: #1382
Change-Id: I0318bfa6e7d7859baf6600ff71715eaef92b401b

Change summary

.github/workflows/build-and-test.yml | 6 +++---
.github/workflows/trunk.yml          | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)

Detailed changes

.github/workflows/build-and-test.yml 🔗

@@ -11,14 +11,14 @@ jobs:
         platform: [ubuntu-latest, macos-latest, windows-latest]
     runs-on: ${{ matrix.platform }}
     steps:
+      - name: Check out code
+        uses: actions/checkout@v4
+
       - name: Set up Go ${{ matrix.go-version }}
         uses: actions/setup-go@v5
         with:
           go-version: ${{ matrix.go-version }}
 
-      - name: Check out code
-        uses: actions/checkout@v4
-
       - name: Build
         run: make
 

.github/workflows/trunk.yml 🔗

@@ -29,12 +29,12 @@ jobs:
       contents: write
       deployments: write
     steps:
+      - uses: actions/checkout@v4
+
       - uses: actions/setup-go@v5
         with:
           go-version: 1.24.2
 
-      - uses: actions/checkout@v4
-
       - name: Run benchmark
         run: go test -v ./... -bench=. -run=xxx -benchmem | tee output.txt