chore: upgrade Go, golangci-lint and CI deps (#5)

Upgrade main development to use Go 1.23, while still running CI against 1.20 and later.

Also update golangci-lint to v2.
This commit is contained in:
2025-06-11 02:12:26 +01:00
committed by GitHub
parent 6cec7b8627
commit c3408f0cfb
4 changed files with 83 additions and 72 deletions

View File

@@ -1,21 +1,20 @@
---
name: CI
on: [push, pull_request]
on: push
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: "1.20"
cache: false
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
version: v1.56
version: v2.1
env:
VERBOSE: "true"
@@ -23,10 +22,10 @@ jobs:
name: Tidy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: "1.20"
go-version-file: go.mod
- name: Check if mods are tidy
run: make check-tidy
@@ -34,12 +33,12 @@ jobs:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: "1.20"
go-version-file: go.mod
- name: Publish coverage
uses: paambaati/codeclimate-action@v5.0.0
uses: paambaati/codeclimate-action@f429536ee076d758a24705203199548125a28ca7 # v9.0.0
env:
VERBOSE: "true"
GOMAXPROCS: 4
@@ -59,10 +58,12 @@ jobs:
- "1.20"
- "1.21"
- "1.22"
- "1.23"
- "1.24"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ matrix.go_version }}
- name: Run tests
@@ -75,7 +76,7 @@ jobs:
release_created: ${{ steps.release-please.outputs.release_created }}
version: ${{ steps.release-please.outputs.version }}
steps:
- uses: jimeh/release-please-manifest-action@v1
- uses: jimeh/release-please-manifest-action@bfd8923580a274363ff9fbaf6d07484fbc8d9c6e #v2.0.0
id: release-please
with:
app-id: ${{ secrets.RELEASE_BOT_APP_ID }}

View File

@@ -1,29 +1,10 @@
linters-settings:
funlen:
lines: 100
statements: 150
goconst:
min-occurrences: 5
ignore-strings: "^ format $"
gocyclo:
min-complexity: 20
golint:
min-confidence: 0
govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment
lll:
line-length: 80
tab-width: 4
maligned:
suggest-new: true
misspell:
locale: US
---
version: "2"
run:
modules-download-mode: readonly
allow-parallel-runners: true
linters:
disable-all: true
default: none
enable:
- asciicheck
- bodyclose
@@ -31,18 +12,14 @@ linters:
- errcheck
- errorlint
- exhaustive
- exportloopref
- funlen
- gochecknoinits
- goconst
- gocritic
- gocyclo
- godot
- gofumpt
- goimports
- goprintffuncname
- gosec
- gosimple
- govet
- importas
- ineffassign
@@ -60,33 +37,63 @@ linters:
- sqlclosecheck
- staticcheck
- tparallel
- typecheck
- unconvert
- unparam
- unused
- wastedassign
- whitespace
issues:
exclude-rules:
- path: "_test\\.go"
linters:
- funlen
- dupl
- source: "^//go:generate "
linters:
- lll
- source: "`json:"
linters:
- lll
- source: "`xml:"
linters:
- lll
- source: "`yaml:"
linters:
- lll
run:
timeout: 2m
allow-parallel-runners: true
modules-download-mode: readonly
settings:
funlen:
lines: 100
statements: 150
goconst:
min-occurrences: 5
gocyclo:
min-complexity: 20
govet:
disable:
- fieldalignment
enable-all: true
lll:
line-length: 80
tab-width: 4
misspell:
locale: US
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- dupl
- funlen
path: _test\.go
- linters:
- lll
source: "^//go:generate "
- linters:
- lll
source: "`json:"
- linters:
- lll
source: "`xml:"
- linters:
- lll
source: "`yaml:"
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofumpt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$

View File

@@ -45,7 +45,7 @@ endef
$(eval $(call tool,godoc,golang.org/x/tools/cmd/godoc@latest))
$(eval $(call tool,gofumpt,mvdan.cc/gofumpt@latest))
$(eval $(call tool,goimports,golang.org/x/tools/cmd/goimports@latest))
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56))
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v2.1.6))
$(eval $(call tool,gomod,github.com/Helcaraxan/gomod@latest))
.PHONY: tools

3
mise.toml Normal file
View File

@@ -0,0 +1,3 @@
[tools]
go = "1.23"
golangci-lint = "2.1"