-
-
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
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
How did you install golangci-lint?
go install
Description of the problem
Trying to upgrade to v2 and it fails on the existing config. I have these previously valid linters in the config:
- gofmt
- gofumpt
- goimports
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version v2.0.0 built with go1.24.1 from (unknown, modified: ?, mod sum: "h1:RQWk8VCuMQv9bBDy3x23yds2yf9aRZ86C9MWGIdNRuU=") on (unknown)
Configuration
issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters: [gosec, bodyclose, noctx]
- linters: [gocritic]
text: "dupArg"
- linters: [gocritic]
text: "exitAfterDefer"
- linters: [gocritic]
text: "appendAssign"
exclude-dirs-use-default: false
exclude-files:
- ".*.pb.go$"
- "proto-gen/.*"
- "model/v1/prototest/.*"
max-issues-per-linter: 0
max-same-issues: 0
linters:
disable:
- errcheck
enable:
# Plain ASCII identifiers.
- asciicheck
# Checks for dangerous unicode character sequences.
- bidichk
# Checks whether HTTP response body is closed successfully.
# TODO enable this but maybe find a way to disable in tests.
- bodyclose
# Check whether the function uses a non-inherited context.
- contextcheck
# Check declaration order of types, consts, vars and funcs.
- decorder
# Checks if package imports are in a list of acceptable packages (see cfg below).
- depguard
# Check for two durations multiplied together.
- durationcheck
# Checks `Err-` prefix for var and `-Error` suffix for error type.
- errname
# Suggests to use `%w` for error-wrapping.
- errorlint
# Checks for pointers to enclosing loop variables.
- copyloopvar
- gocritic
- gofmt
- gofumpt
- goimports
# Allow or ban replace directives in go.mod
# or force explanation for retract directives.
# Maybe enable once we get rid of old sarama.
# - gomoddirectives
- gosec
# Linter that specializes in simplifying code.
- gosimple
- govet
# Detects when assignments to existing variables are not used.
- ineffassign
- misspell
# Finds naked/bare returns and requires change them.
- nakedret
# Require a bit more explicit returns.
- nilerr
# Finds sending HTTP request without context.Context.
- noctx
# Reports ill-formed or insufficient nolint directives.
- nolintlint
# Checks that fmt.Sprintf can be replaced with a faster alternative.
- perfsprint
# Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
- revive
# Checks usage of github.com/stretchr/testify.
- testifylint
# Detects the possibility to use variables/constants from the Go standard library.
- usestdlibvars
# TODO consider adding more linters, cf. https://olegk.dev/go-linters-configuration-the-right-version
linters-settings:
depguard:
rules:
main:
files: ["$all"]
allow:
- "$gostd"
- "github.com/stretchr/testify"
- "github.com/gogo/protobuf"
- "github.com/jaegertracing/jaeger-idl"
- "go.uber.org/goleak"
run:
go: "1.23"
timeout: 20m
Go environment
$ go version && go env
go version go1.24.1 darwin/arm64
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
INFO golangci-lint has version v2.0.0 built with go1.24.1 from (unknown, modified: ?, mod sum: "h1:RQWk8VCuMQv9bBDy3x23yds2yf9aRZ86C9MWGIdNRuU=") on (unknown)
INFO [config_reader] Config search paths: [./ /Users/ysh/dev/jaegertracing/jaeger-idl /Users/ysh/dev/jaegertracing /Users/ysh/dev /Users/ysh /Users /]
INFO [config_reader] Used config file .golangci.yaml
Error: can't load config: gofmt is a formatter
Failed executing command with error: can't load config: gofmt is a formatter
A minimal reproducible example or link to a public repository
Validation
- Yes, I've included all information above (version, config, etc.).
Supporter
- I am a sponsor/backer through GitHub or OpenCollective
hf-kklein
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested