chore(ci/deps): upgrade CI dependencies and fix linting issues (#136)

This commit is contained in:
2025-06-27 11:25:16 +01:00
committed by GitHub
parent 3cf1977def
commit 28ff28b29a
6 changed files with 85 additions and 70 deletions

View File

@@ -1,5 +1,6 @@
{
"bootstrap-sha": "3d6c7fff64bda8ba0dbea181c9f94fb9716dd188",
"always-update": true,
"packages": {
".": {
"release-type": "simple",

View File

@@ -10,11 +10,11 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23"
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v8
with:
version: v1.61
version: v2.1
env:
VERBOSE: "true"
@@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23"
go-version-file: go.mod
- name: Check if mods are tidy
run: make check-tidy
@@ -36,14 +36,18 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23"
go-version-file: go.mod
- name: Run tests
run: make test
env:
VERBOSE: "true"
release-please:
name: Release Please
runs-on: ubuntu-latest
if: github.ref_name == 'main' || github.ref_name == 'master'
if: ${{ github.ref_name == 'main' || github.ref_name == 'master' }}
permissions:
contents: read
pull-requests: write
steps:
- uses: jimeh/release-please-manifest-action@v1
- uses: jimeh/release-please-manifest-action@v2

View File

@@ -1,25 +1,9 @@
linters-settings:
funlen:
lines: 100
statements: 150
goconst:
min-occurrences: 5
gocyclo:
min-complexity: 20
govet:
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:
- bodyclose
- copyloopvar
@@ -30,12 +14,8 @@ linters:
- goconst
- gocritic
- gocyclo
- gofumpt
- goimports
- goprintffuncname
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
@@ -47,36 +27,69 @@ linters:
- revive
- sqlclosecheck
- staticcheck
- typecheck
- unconvert
- unused
- whitespace
issues:
exclude:
- Using the variable on range scope `tt` in function literal
- Using the variable on range scope `tc` in function literal
exclude-rules:
- path: "_test\\.go"
linters:
- funlen
- dupl
- goconst
- source: "^//go:generate "
linters:
- lll
- source: "`json:"
linters:
- lll
- source: "`yaml:"
linters:
- lll
exclude-dirs:
- builds
- sources
- tarballs
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
- goconst
path: _test\.go
- linters:
- lll
source: "^//go:generate "
- linters:
- lll
source: "`json:"
- linters:
- lll
source: "`yaml:"
- path: (.+)\.go$
text: Using the variable on range scope `tt` in function literal
- path: (.+)\.go$
text: Using the variable on range scope `tc` in function literal
paths:
- builds
- sources
- tarballs
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofumpt
- goimports
exclusions:
generated: lax
paths:
- builds
- sources
- tarballs
- third_party$
- builtin$
- examples$

View File

@@ -71,7 +71,7 @@ $(TOOLDIR)/$(1): Makefile
endef
$(eval $(call tool,gofumpt,mvdan.cc/gofumpt@latest))
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61))
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1))
$(eval $(call tool,gomod,github.com/Helcaraxan/gomod@latest))
.PHONY: tools

View File

@@ -287,7 +287,7 @@ func (s *Updater) createRepoFile(
s.logger.Info(
"new commit created",
"commit", contResp.GetSHA(), "message", contResp.GetMessage(),
"url", contResp.Commit.GetHTMLURL(),
"url", contResp.GetHTMLURL(),
)
return nil
@@ -354,7 +354,7 @@ func (s *Updater) updateRepoFile(
s.logger.Info(
"new commit created",
"commit", contResp.GetSHA(), "message", contResp.GetMessage(),
"url", contResp.Commit.GetHTMLURL(),
"url", contResp.GetHTMLURL(),
)
return true, nil

View File

@@ -65,10 +65,7 @@ func (s *OSInfo) distinctVersion(version string) string {
return parts[0]
}
max := len(parts)
if max > 2 {
max = 2
}
end := min(len(parts), 2)
return strings.Join(parts[0:max], ".")
return strings.Join(parts[0:end], ".")
}