-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--new-from-rev not working in binary installation #4047
Labels
question
Further information is requested
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Everything works as expected: example 1$ git init rev-binary && cd $_
$ git commit -m "chore: initial empty commit." --allow-empty
[main (root-commit) ff0b5a7] chore: initial empty commit.
$ go mod init github.com/gcl/example
go: creating new go.mod: module github.com/gcl/example
$ git add .
$ git commit -m "chore: setup project"
$ cat <<EOF > foo.go
package foo
func bar() {
unusedVariableForTest := 0
}
EOF
$ git add .
$ git commit -m "introduced unused var"
$ golangci-lint run
foo.go:1: : # github.com/gcl/example
./foo.go:4:5: unusedVariableForTest declared and not used (typecheck)
package foo
$ golangci-lint run --new-from-rev HEAD~1
foo.go:1: : # github.com/gcl/example
./foo.go:4:5: unusedVariableForTest declared and not used (typecheck)
package foo
$ curl -Lf https://github.com/golangci/golangci-lint/releases/download/v1.54.2/golangci-lint-1.54.2-linux-amd64.tar.gz | tar xz -C . --strip-components=1 && chmod +x ./golangci-lint
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 9774k 100 9774k 0 0 18.4M 0 --:--:-- --:--:-- --:--:-- 18.4M
$ ./golangci-lint run --new-from-rev HEAD~1
foo.go:1: : # github.com/gcl/example
./foo.go:4:5: unusedVariableForTest declared and not used (typecheck)
package foo example 2$ git init rev-binary && cd $_
$ git commit -m "chore: initial empty commit." --allow-empty
[main (root-commit) ff0b5a7] chore: initial empty commit.
$ go mod init github.com/gcl/example
go: creating new go.mod: module github.com/gcl/example
$ git add .
$ cat <<EOF > foo.go
package foo
func bar() {}
EOF
$ git commit -m "chore: setup project"
$ cat <<EOF > foo.go
package foo
func bar() {
unusedVariableForTest := 0
}
EOF
$ git add .
$ git commit -m "introduced unused var"
$ golangci-lint run
foo.go:1: : # github.com/gcl/example
./foo.go:4:5: unusedVariableForTest declared and not used (typecheck)
package foo
$ golangci-lint run --new-from-rev HEAD~1
$ golangci-lint run --new-from-rev HEAD~2
foo.go:1: : # github.com/gcl/example
./foo.go:4:5: unusedVariableForTest declared and not used (typecheck)
package foo
$ curl -Lf https://github.com/golangci/golangci-lint/releases/download/v1.54.2/golangci-lint-1.54.2-linux-amd64.tar.gz | tar xz -C . --strip-components=1 && chmod +x ./golangci-lint
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 9774k 100 9774k 0 0 18.4M 0 --:--:-- --:--:-- --:--:-- 18.4M
$ ./golangci-lint run --new-from-rev HEAD~1
$ ./golangci-lint run --new-from-rev HEAD~2
foo.go:1: : # github.com/gcl/example
./foo.go:4:5: unusedVariableForTest declared and not used (typecheck)
package foo
|
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Welcome
Description of the problem
--new-from-rev doesn't work now
Version of golangci-lint
Downloaded as binary from releases
Configuration
No configuration file
--new-from-rev <sha of 1 commit before HEAD>
Go environment
Verbose output of running
A minimal reproducible example or link to a public repository
First make an undesirable change that introduces a linting error
Commit it with
$ git commit -m "introduced unused var"
The expected unusedVar error doesn't show up in
--new-from-rev
neither withHEAD~1
nor withHEAD~2
and also not with explicitly using a long SHA of 1 or 2 commits before. But they show up when running on the whole repo without--new-from-rev
.Validation
The text was updated successfully, but these errors were encountered: