Skip to content

Commit

Permalink
Update CI to use golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
graveland committed Apr 25, 2024
1 parent 6b0a80d commit 31bcdc1
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,40 @@ name: Go

on:
push:
branches: [ master ]
branches: [ "**" ]
pull_request:
branches: [ master ]
branches: [ "**" ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: read
checks: write

jobs:
build:
strategy:
matrix:
go-versions: [1.16.x, 1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
- uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-versions }}
- name: Install
run: GO111MODULE=off go get golang.org/x/lint/golint
- name: Run gofmt
run: diff -u <(echo -n) <(gofmt -d *.go)
- name: Run golint
run: diff -u <(echo -n) <(golint $(go list -e ./... | grep -v /goyaml) | grep -v YAMLToJSON)
- name: Run go vet
run: GO111MODULE=on go vet .
cache: false

- name: lint
uses: golangci/golangci-lint-action@v5
with:
version: latest

- name: Run go test
run: GO111MODULE=on go test -v -race ./...
- name: Check diff
run: git diff --exit-code

0 comments on commit 31bcdc1

Please sign in to comment.