Skip to content
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
26 changes: 13 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: Tests

on:
push:
pull_request:

jobs:
test:
name: Test and coverage
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.21
go-version: stable
id: go

- name: Checkout code
Expand All @@ -36,10 +35,10 @@ jobs:
name: go vet and lint
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.21
go-version: stable
id: go

- name: Checkout code
Expand All @@ -52,13 +51,14 @@ jobs:
run: go vet ./...

golangci:
name: golangci lint check
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v8
with:
version: v1.54.0
version: v2.1
115 changes: 29 additions & 86 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,94 +1,37 @@
version: "2"
run:
timeout: 5m
issues-exit-code: 1
tests: true
modules-download-mode: readonly

linters-settings:
goimports:
local-prefixes: github.com/counterapi/api
golint:
min-confidence: 0
govet:
check-shadowing: true
misspell:
locale: US
nolintlint:
allow-leading-space: false
allow-unused: false
require-explanation: true
require-specific: false
funlen:
lines: 80
formatters:
settings:
goimports:
local-prefixes:
- github.com/counterapi/api
linters:
default: standard
exclusions:
# Log a warning if an exclusion rule is unused.
# Default: false
warn-unused: true
# Predefined exclusion rules.
# Default: []
presets:
- std-error-handling
- common-false-positives
# Excluding configuration per-path, per-linter, per-text and per-source.
rules:
- path: '_test\.go'
linters:
- bodyclose
- dupl
- errcheck
- funlen
- goconst
- gosec
- noctx
- wrapcheck

issues:
exclude-rules:
- path: _test\.go
linters:
- goerr113
- gocyclo
- errcheck
- gosec
- dupl
- funlen
- scopelint
- testpackage

linters:
disable-all: true
enable:
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
- asciicheck
- bodyclose
# - depguard
- dogsled
- dupl
- exportloopref
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- goerr113
- gofmt
- gofumpt
- goimports
- golint
- gomnd
- gomodguard
- goprintffuncname
- gosec
- interfacer
- lll
- maligned
- misspell
- nakedret
- nestif
- noctx
- nolintlint
- prealloc
- rowserrcheck
- scopelint
- sqlclosecheck
- stylecheck
- unconvert
- unparam
- whitespace
- wsl
- tparallel
# don't enable:
# - go-header
# - testpackage
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ lint:
gofmt -l . | tee $(BUFFER)
@! test -s $(BUFFER)
go vet ./...
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.1
@golangci-lint --version
golangci-lint run

.PHONY: test
Expand Down
Loading
Loading