Closed
Description
Welcome
- Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
- Yes, I've searched similar issues on GitHub and didn't find any.
- Yes, I've read the
typecheck
section of the FAQ. - Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
- I agree to follow this project's Code of Conduct
Description of the problem
golangci-lint 1.60.1 incorrectly reports
SA3000: TestMain should call os.Exit to set exit code (staticcheck)
on go 1.22 or 1.23.
Note that golangci-lint 1.59.1 does not report SA3000.
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.60.1 built with go1.23.0 from 3298c104 on 2024-08-14T01:15:05Z
Configuration
# no configuration file
Go environment
$ go version && go env
go version go1.22.6 darwin/arm64
GO111MODULE=''
GOARCH='arm64'
GOBIN='/Users/skaji/bin'
GOCACHE='/Users/skaji/Library/Caches/go-build'
GOENV='/Users/skaji/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/skaji/.gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/skaji/.gopath'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/skaji/env/goenv/versions/1.22.6'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/skaji/env/goenv/versions/1.22.6/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.6'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/skaji/try/20240811/playground/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/_m/8hkr1h916g39vfcj0fltmlb00000gn/T/go-build3633526964=/tmp/go-build -gno-record-gcc-switches -fno-common'
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
INFO golangci-lint has version 1.60.1 built with go1.23.0 from 3298c104 on 2024-08-14T01:15:05Z
INFO [config_reader] Config search paths: [./ /Users/skaji/try/20240811/playground /Users/skaji/try/20240811 /Users/skaji/try /Users/skaji /Users /]
INFO [lintersdb] Active 6 linters: [errcheck gosimple govet ineffassign staticcheck unused]
INFO [loader] Go packages loading at mode 575 (types_sizes|compiled_files|deps|files|imports|exports_file|name) took 131.124041ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 79.375µs
INFO [linters_context/goanalysis] analyzers took 877.890789ms with top 10 stages: buildir: 667.14208ms, inspect: 34.550292ms, fact_deprecated: 31.254588ms, ctrlflow: 27.959335ms, fact_purity: 25.951583ms, SA5012: 25.154119ms, printf: 23.488038ms, nilness: 19.883499ms, typedness: 18.878253ms, tokenfileanalyzer: 1.785499ms
INFO [runner] Processors filtering stat (in/out): exclude-rules: 1/1, max_from_linter: 1/1, severity-rules: 1/1, sort_results: 1/1, path_shortener: 1/1, path_prefixer: 1/1, filename_unadjuster: 1/1, skip_files: 1/1, skip_dirs: 1/1, autogenerated_exclude: 1/1, diff: 1/1, path_prettifier: 1/1, max_same_issues: 1/1, source_code: 1/1, uniq_by_line: 1/1, max_per_file_from_linter: 1/1, fixer: 1/1, cgo: 1/1, invalid_issue: 1/1, identifier_marker: 1/1, exclude: 1/1, nolint: 1/1
INFO [runner] processing took 187.5µs with stages: path_prettifier: 37.584µs, identifier_marker: 32.875µs, exclude-rules: 32.249µs, nolint: 27.876µs, autogenerated_exclude: 26.792µs, source_code: 15.458µs, skip_dirs: 6.167µs, invalid_issue: 1.792µs, uniq_by_line: 1.292µs, cgo: 1.125µs, max_same_issues: 875ns, path_shortener: 749ns, filename_unadjuster: 583ns, exclude: 458ns, max_from_linter: 375ns, skip_files: 292ns, sort_results: 291ns, fixer: 250ns, max_per_file_from_linter: 167ns, diff: 84ns, severity-rules: 83ns, path_prefixer: 83ns
INFO [runner] linters took 610.295625ms with stages: goanalysis_metalinter: 610.037584ms
main_test.go:5:1: SA3000: TestMain should call os.Exit to set exit code (staticcheck)
func TestMain(m *testing.M) {
^
INFO File cache stats: 1 entries of total size 73B
INFO Memory: 9 samples, avg is 134.9MB, max is 207.4MB
INFO Execution took 781.692875ms
A minimal reproducible example or link to a public repository
go.mod:
module playground
go 1.22.0
main_test.go:
package main
import "testing"
func TestMain(m *testing.M) {
m.Run()
}
Then:
❯ golangci-lint version && golangci-lint cache clean && golangci-lint run; echo $?
golangci-lint has version 1.60.1 built with go1.23.0 from 3298c104 on 2024-08-14T01:15:05Z
main_test.go:5:1: SA3000: TestMain should call os.Exit to set exit code (staticcheck)
func TestMain(m *testing.M) {
^
1
Note1: golangci-lint 1.59.1 does not report anything.
❯ golangci-lint version && golangci-lint cache clean && golangci-lint run; echo $?
golangci-lint has version 1.59.1 built with go1.22.3 from 1a55854a on 2024-06-09T18:08:33Z
0
Note2: Standalone staticcheck does not report anything.
❯ staticcheck -version && staticcheck; echo $?
staticcheck 2024.1 (0.5.0)
0
Validation
- Yes, I've included all information above (version, config, etc.).
Supporter
- I am a sponsor/backer through GitHub or OpenCollective