Skip to content

Upgrade to golangci-lint 2 #127

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

Merged
merged 5 commits into from
Mar 24, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Build
strategy:
matrix:
go-version: [1.21.x, 1.22.x]
go-version: [1.23.x, 1.24.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v7
with:
version: latest
192 changes: 0 additions & 192 deletions .golangci.toml

This file was deleted.

174 changes: 174 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
version: "2"
run:
go: "1.23"
tests: true
allow-parallel-runners: true
linters:
default: all
disable:
- cyclop
- depguard
- err113
- exhaustive
- exhaustruct
- forcetypeassert
- funlen
- gochecknoglobals
- gocognit
- godox
- gosmopolitan
- inamedparam
- interfacebloat
- mnd
- nlreturn
- nonamedreturns
- paralleltest
- testpackage
- thelper
- varnamelen
- wrapcheck
- wsl
settings:
errorlint:
errorf: true
asserts: true
comparison: true
exhaustive:
default-signifies-exhaustive: true
forbidigo:
forbid:
- pattern: Geoip
msg: you should use `GeoIP`
- pattern: geoIP
msg: you should use `geoip`
- pattern: Maxmind
msg: you should use `MaxMind`
- pattern: ^maxMind
msg: you should use `maxmind`
- pattern: Minfraud
msg: you should use `MinFraud`
- pattern: ^minFraud
msg: you should use `minfraud`
- pattern: ^math.Max$
msg: you should use the max built-in instead.
- pattern: ^math.Min$
msg: you should use the min built-in instead.
- pattern: ^os.IsNotExist
msg: As per their docs, new code should use errors.Is(err, fs.ErrNotExist).
- pattern: ^os.IsExist
msg: As per their docs, new code should use errors.Is(err, fs.ErrExist)
gosec:
excludes:
- G115
govet:
disable:
- shadow
enable-all: true
lll:
line-length: 120
tab-width: 4
misspell:
locale: US
extra-words:
- typo: marshall
correction: marshal
- typo: marshalling
correction: marshaling
- typo: marshalls
correction: marshals
- typo: unmarshall
correction: unmarshal
- typo: unmarshalling
correction: unmarshaling
- typo: unmarshalls
correction: unmarshals
nolintlint:
require-explanation: true
require-specific: true
allow-no-explanation:
- lll
- misspell
allow-unused: false
revive:
severity: warning
enable-all-rules: true
rules:
- name: add-constant
disabled: true
- name: cognitive-complexity
disabled: true
- name: confusing-naming
disabled: true
- name: confusing-results
disabled: true
- name: cyclomatic
disabled: true
- name: deep-exit
disabled: true
- name: flag-parameter
disabled: true
- name: function-length
disabled: true
- name: function-result-limit
disabled: true
- name: line-length-limit
disabled: true
- name: max-public-structs
disabled: true
- name: nested-structs
disabled: true
- name: unchecked-type-assertion
disabled: true
- name: unhandled-error
disabled: true
tagliatelle:
case:
rules:
avro: snake
bson: snake
env: upperSnake
envconfig: upperSnake
json: snake
mapstructure: snake
xml: snake
yaml: snake
unparam:
check-exported: true
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- govet
- revive
path: _test.go
text: 'fieldalignment:'
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
- golines
settings:
gci:
sections:
- standard
- default
- prefix(github.com/oschwald/geoip2-golang)
gofumpt:
extra-rules: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/oschwald/geoip2-golang

go 1.21
go 1.23.0

require (
github.com/oschwald/maxminddb-golang v1.13.1
Expand Down
Loading
Loading