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

View File

@@ -1,29 +1,10 @@
linters-settings: ---
funlen: version: "2"
lines: 100 run:
statements: 150 modules-download-mode: readonly
goconst: allow-parallel-runners: true
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
linters: linters:
disable-all: true default: none
enable: enable:
- asciicheck - asciicheck
- bodyclose - bodyclose
@@ -31,18 +12,14 @@ linters:
- errcheck - errcheck
- errorlint - errorlint
- exhaustive - exhaustive
- exportloopref
- funlen - funlen
- gochecknoinits - gochecknoinits
- goconst - goconst
- gocritic - gocritic
- gocyclo - gocyclo
- godot - godot
- gofumpt
- goimports
- goprintffuncname - goprintffuncname
- gosec - gosec
- gosimple
- govet - govet
- importas - importas
- ineffassign - ineffassign
@@ -60,33 +37,63 @@ linters:
- sqlclosecheck - sqlclosecheck
- staticcheck - staticcheck
- tparallel - tparallel
- typecheck
- unconvert - unconvert
- unparam - unparam
- unused - unused
- wastedassign - wastedassign
- whitespace - whitespace
settings:
issues: funlen:
exclude-rules: lines: 100
- path: "_test\\.go" statements: 150
linters: goconst:
- funlen min-occurrences: 5
- dupl gocyclo:
- source: "^//go:generate " min-complexity: 20
linters: govet:
- lll disable:
- source: "`json:" - fieldalignment
linters: enable-all: true
- lll lll:
- source: "`xml:" line-length: 80
linters: tab-width: 4
- lll misspell:
- source: "`yaml:" locale: US
linters: exclusions:
- lll generated: lax
presets:
run: - comments
timeout: 2m - common-false-positives
allow-parallel-runners: true - legacy
modules-download-mode: readonly - 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,godoc,golang.org/x/tools/cmd/godoc@latest))
$(eval $(call tool,gofumpt,mvdan.cc/gofumpt@latest)) $(eval $(call tool,gofumpt,mvdan.cc/gofumpt@latest))
$(eval $(call tool,goimports,golang.org/x/tools/cmd/goimports@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)) $(eval $(call tool,gomod,github.com/Helcaraxan/gomod@latest))
.PHONY: tools .PHONY: tools

3
mise.toml Normal file
View File

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