Description
Welcome
- Yes, I'm using a binary release within 2 latest major 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 (https://golangci-lint.run/usage/faq/#why-do-you-have-typecheck-errors).
- Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.). (https://golangci-lint.run/usage/linters/)
Description of the problem
I'm using new-from-rev
to avoid lint from legacy code, and it worked well previously.
But, when I delete some of the codes in the middle of the legacy file, and it causes the old code to be included in the lint.
I did similar behavior before, and it was fine for that situation, but for this case, all the codes in the legacy file under the deleted code are included into lint.
It's a bit hard to reproduce with minimal example because I tried, but all cases was fine. So, I think it seems extremely corner case. But, when I check the git diff, it is not a problem of git diff, it detects only changed part.
Are there any known issue for this?
I'll try to find a way with some of the public project which has a lot of long code, but for now, in order to check is known issue or, are there any solution. So, I raised issue first.
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.57.2 built with go1.22.1 from 77a8601a on 2024-03-28T19:01:11Z
I tested with 1.55.2 too.
Configuration
issues:
exclude:
- SA1019
new-from-rev: 6ce5c895
Go environment
$ go version && go env
go version go1.20.4 darwin/arm64
GO111MODULE=""
GOARCH="arm64"
GOBIN="/Users/wangmir/go/bin"
GOCACHE="/Users/wangmir/Library/Caches/go-build"
GOENV="/Users/wangmir/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/wangmir/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/wangmir/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.20.4"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -fdebug-prefix-map=/var/folders/pl/hz15bk5d0cg7dnfqc59gw0k40000gn/T/go-build1595526823=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here
A minimal reproducible example or link to a public repository
Actually, it's hard to reproducable, I tried to reproduce with some codes, but I failed. In normal case, deletion of the code in the old code will not affect to the new-from-rev
.
But, only happening with large complex code case.
I'll further try to find a way to reproduce this with public large project.
Validation
- Yes, I've included all information above (version, config, etc.).