Skip to content

Commit a2b5287

Browse files
authored
Merge pull request #354 from maratori/dependabot/docker/golangci/golangci-lint-v2.6.1
Bump golangci/golangci-lint from v2.5.0 to v2.6.1
2 parents c6fd625 + 151986a commit a2b5287

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

.github/workflows/ci.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ jobs:
4646
go-version: "1.25.4" # update together with dev.dockerfile
4747
- run: make test-latest-deps
4848

49+
test22:
50+
name: "test go 1.22"
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v5
54+
- uses: actions/setup-go@v6
55+
with:
56+
go-version: "1.22"
57+
- run: make test
58+
4959
lint:
5060
runs-on: ubuntu-latest
5161
steps:
@@ -55,7 +65,7 @@ jobs:
5565
go-version: "1.25.4" # update together with dev.dockerfile
5666
- uses: golangci/golangci-lint-action@v8
5767
with:
58-
version: "v2.5.0" # update together with dev.dockerfile
68+
version: "v2.6.1" # update together with dev.dockerfile
5969

6070
lint-latest-deps:
6171
runs-on: ubuntu-latest
@@ -67,7 +77,7 @@ jobs:
6777
- run: make apply-latest-deps
6878
- uses: golangci/golangci-lint-action@v8
6979
with:
70-
version: "v2.5.0" # update together with dev.dockerfile
80+
version: "v2.6.1" # update together with dev.dockerfile
7181

7282
check-tidy:
7383
name: go mod tidy

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ linters:
7777
- makezero # finds slice declarations with non-zero initial length
7878
- mirror # reports wrong mirror patterns of bytes/strings usage
7979
- mnd # detects magic numbers
80+
- modernize # suggests simplifications to Go code, using modern language and library features
8081
- musttag # enforces field tags in (un)marshaled structs
8182
- nakedret # finds naked returns in functions greater than a specified function length
8283
- nestif # reports deeply nested if statements

dev.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
FROM golang:1.25.4 AS go
33

44
# update together with .github/workflows/ci.yml
5-
FROM golangci/golangci-lint:v2.5.0 AS linter
5+
FROM golangci/golangci-lint:v2.6.1 AS linter
66

77
FROM go AS dev
88
ENV INSIDE_DEV_CONTAINER=1

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/maratori/testpackage
22

3-
go 1.22.0 // minimal supported version 1.18, tested all versions up to 1.24
3+
go 1.22.0 // minimal supported version 1.22, tested all versions up to 1.25
44

55
require golang.org/x/tools v0.26.0
66

pkg/testpackage/testpackage.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package testpackage
22

33
import (
44
"flag"
5+
"go/ast"
56
"regexp"
7+
"slices"
68
"strings"
79

8-
"go/ast"
9-
1010
"golang.org/x/tools/go/analysis"
1111
)
1212

@@ -25,10 +25,8 @@ const (
2525
func processTestFile(pass *analysis.Pass, f *ast.File, allowedPackages []string) {
2626
packageName := f.Name.Name
2727

28-
for _, p := range allowedPackages {
29-
if p == packageName {
30-
return
31-
}
28+
if slices.Contains(allowedPackages, packageName) {
29+
return
3230
}
3331

3432
if !strings.HasSuffix(packageName, "_test") {
@@ -51,7 +49,7 @@ func NewAnalyzer() *analysis.Analyzer {
5149
Name: "testpackage",
5250
Doc: "linter that makes you use a separate _test package",
5351
Flags: fs,
54-
Run: func(pass *analysis.Pass) (interface{}, error) {
52+
Run: func(pass *analysis.Pass) (any, error) {
5553
allowedPackages := strings.Split(allowPackagesStr, ",")
5654
skipFile, err := regexp.Compile(skipFileRegexp)
5755
if err != nil {

0 commit comments

Comments
 (0)