Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add linter rules, update github actions #8

Merged
merged 5 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,35 @@ jobs:
steps:

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
stable: 'false'
go-version: '1.21'

- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Cache Go modules
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
miparnisari marked this conversation as resolved.
Show resolved Hide resolved
${{ runner.OS }}-

- name: Lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v4
with:
version: v1.54.2
args: --timeout 10m

- name: Vet
if: matrix.os == 'ubuntu-latest'
run: go vet -v ./...
version: latest
args: -v -c .golangci.yaml

- name: Build
env:
CGO_ENABLED: 0
run: go build -ldflags "-s -w" ./...

- name: Test
run: go test -v -race ./...
run: go test -v -count=1 -race ./...
36 changes: 36 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
run:
timeout: 10m
allow-parallel-runners: true

linters:
enable:
- errname
- stylecheck
- importas
- errcheck
- gosimple
- govet
- ineffassign
- mirror
- staticcheck
- tagalign
- testifylint
- typecheck
- unused
- unconvert
- wastedassign
- whitespace
- gocritic
- exhaustive
- noctx
- promlinter
# TODO these fail on windows
# - gofmt
# - goimports

linters-settings:
govet:
enable-all: true
disable:
- shadow
- fieldalignment
Loading