github.com/yaling888/clash@v1.53.0/.github/workflows/linter.yml (about) 1 name: Linter 2 on: [push, pull_request] 3 jobs: 4 lint: 5 runs-on: ubuntu-latest 6 steps: 7 - uses: actions/checkout@v4 8 9 - name: Get latest go version 10 id: version 11 run: | 12 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}') 13 latest_go_version=$(curl -sSL https://go.dev/dl/?mode=json | grep "version" | cut -d\" -f4 | awk -Fgo '(NR==1){printf $2}') || "" 14 go_version="$latest_go_version" 15 16 if [[ -z "$latest_go_version" ]] || [[ $go_mod_version =~ .*[rc|beta].* ]]; then 17 go_version="$go_mod_version" 18 fi 19 20 echo "go_version=${go_version}" >> $GITHUB_OUTPUT 21 22 - name: Setup Go 23 uses: actions/setup-go@v5 24 with: 25 go-version: ${{ steps.version.outputs.go_version }} 26 check-latest: true 27 cache: false 28 29 - name: golangci-lint 30 uses: golangci/golangci-lint-action@v4 31 with: 32 version: latest 33 args: --timeout=3m