-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
questionFurther information is requestedFurther information is requested
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
typechecksection 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
How did you install golangci-lint?
Via editor/IDE
Description of the problem
golangci-lint provides linters specifically for the go.mod file so I expect to be able to lint it.
There are not always go source files in the same directory as the go.mod file.
Action:
I try to lint only this part of the source using golangci-lint run /path/to/dir/with/gomod.
Expected behaviour:
golangci-lint lints my go.mod file
Actual behavior:
golangci-lint returns an error since the directory did not contain any go source files
ERRO Running error: context loading failed: failed to load packages: failed to load packages: package <path>: no go files to analyze
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 2.4.0 built with go1.25.0 from 43d03392 on 2025-08-13T23:36:29ZjConfiguration
version: "2"
formatters:
enable:
- gofumpt
- goimports
exclusions:
paths:
- vendor
linters:
enable:
- gochecknoglobals
- gochecknoinits
- lll
- misspell
- godot
- noctx
- contextcheck
- containedctx
- revive
- testableexamples
- nilnil
- ireturn
- nonamedreturns
- nakedret
- varnamelen
- errorlint
- loggercheck
- forbidigo
- staticcheck
exclusions:
paths:
- vendor
Go environment
$ go version && go env
go version go1.25.1 darwin/arm64
AR='ar'
CC='cc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='c++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/gfleming/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/gfleming/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/1d/_wdt4bm96_5c915q5m2sh6sc0000gn/T/g
o-build1664847679=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/gfleming/Projects/Personal/grpcstuff/go.mod'
GOMODCACHE='/Users/gfleming/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/gfleming/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.25.1/libexec'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/gfleming/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.25.1/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.25.1'
GOWORK=''
PKG_CONFIG='pkg-config'Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
# paste output hereA minimal reproducible example or link to a public repository
// add your code hereValidation
- Yes, I've included all information above (version, config, etc.).
Supporter
- I am a sponsor/backer through GitHub or OpenCollective
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested