forked from yaling888/quirktiva
-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (28 loc) · 1.07 KB
/
linter.yml
File metadata and controls
33 lines (28 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Linter
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Get latest go version
id: version
run: |
go_mod_version=$(cat go.mod | grep -oE '^go [0-9]{1,}.[0-9|a-z]{1,}(.[0-9]{1,})?' | awk '(NR==1){printf $2}' | sed 's/beta/.0-beta./' | sed 's/rc/.0-rc./')
latest_go_version=$(curl -sSL https://go.dev/dl/?mode=json | grep "version" | cut -d\" -f4 | awk -Fgo '(NR==1){printf $2}') || ""
go_version="$latest_go_version"
if [[ -z "$latest_go_version" ]] || [[ $go_mod_version =~ .*[rc|beta].* ]]; then
go_version="$go_mod_version"
fi
echo "go_version=${go_version}" >> $GITHUB_OUTPUT
echo "go version go${go_version}"
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ steps.version.outputs.go_version }}
check-latest: true
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: latest