Skip to content

Commit

Permalink
GH Actions: run actions/setup-go@v5 before golangci-lint
Browse files Browse the repository at this point in the history
This is recommended by the `golangci-lint` README, see
https://github.com/golangci/golangci-lint-action/blob/e637d2bbe4e0571eb57bfc3615ba14992312228d/README.md#compatibility:

> * `v4.0.0+` requires an explicit setup-go installation step before
>   using this action: `uses: actions/setup-go@v5`. The
>   `skip-go-installation` option has been removed.

`go mod download` is also run before `golangci-lint` just in case
because it fixed some people's problems (see
golangci/golangci-lint-action#902 (comment)).
It is also re-added to the "Test" job, because it turned out that
`actions/setup-go@v5` doesn't download dependencies as I thought it
would.
  • Loading branch information
generalmimon committed Mar 29, 2024
1 parent 2f48aed commit 1d509f8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
with:
go-version: '1.21'

- run: go mod download

- name: Test
run: go test -v ./...

Expand All @@ -28,6 +30,13 @@ jobs:

- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: false

- run: go mod download

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
Expand Down

0 comments on commit 1d509f8

Please sign in to comment.