File tree Expand file tree Collapse file tree 5 files changed +20
-11
lines changed Expand file tree Collapse file tree 5 files changed +20
-11
lines changed Original file line number Diff line number Diff line change 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 :
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
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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 22FROM 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
77FROM go AS dev
88ENV INSIDE_DEV_CONTAINER=1
Original file line number Diff line number Diff line change 11module 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
55require golang.org/x/tools v0.26.0
66
Original file line number Diff line number Diff line change @@ -2,11 +2,11 @@ package testpackage
22
33import (
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 (
2525func 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 {
You can’t perform that action at this time.
0 commit comments