Skip to content
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

Detects Go 1.18 Fuzz methods as unused code #2650

Closed
4 tasks done
Hades32 opened this issue Mar 16, 2022 · 5 comments · Fixed by #2704
Closed
4 tasks done

Detects Go 1.18 Fuzz methods as unused code #2650

Hades32 opened this issue Mar 16, 2022 · 5 comments · Fixed by #2704
Labels
bug Something isn't working

Comments

@Hades32
Copy link

Hades32 commented Mar 16, 2022

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 included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

Description of the problem

$ golangci-lint run                                                          
grid_test.go:128:6: `FuzzRectVsGrid` is unused (deadcode)
func FuzzRectVsGrid(f *testing.F) {

Version of golangci-lint

golangci-lint has version v1.44.2 built from (unknown, mod sum: "h1:MzvkDt1j1OHkv42/feNJVNNXRFACPp7aAWBWDo5aYQw=") on (unknown)

Configuration file

none

Go environment

go version go1.18 linux/amd64

Verbose output of running

Code example or link to a public repository

func FuzzRectVsGrid(f *testing.F) {
}
@Hades32 Hades32 added the bug Something isn't working label Mar 16, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Mar 16, 2022

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez
Copy link
Member

ldez commented Mar 16, 2022

Hello,

Currently golangci-lint doesn't support go1.18, you can follow #2649

https://github.com/golangci/go-misc/deadcode

@ldez
Copy link
Member

ldez commented Mar 16, 2022

With a compiled version of golangci-lint with Go1.18, I don't reproduce the problem.

@ldez ldez added the feedback required Requires additional feedback label Mar 26, 2022
@DasSkelett
Copy link

DasSkelett commented Mar 29, 2022

This also happens for me with v1.45.2 downloaded through the install script:
https://gitlab.com/DasSkelett/apnic-ipv6-stats-json-exporter/-/jobs/2265816300

$ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin
golangci/golangci-lint info checking GitHub for latest tag
golangci/golangci-lint info found version: 1.45.2 for v1.45.2/linux/amd64
golangci/golangci-lint info installed /usr/local/bin/golangci-lint

$ golangci-lint run
level=warning msg="[linters context] gosimple is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
level=warning msg="[linters context] staticcheck is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
level=warning msg="[linters context] structcheck is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
level=warning msg="[linters context] unused is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
querier_fuzz_test.go:11:6: `FuzzTarget_ToString` is unused (deadcode)
func FuzzTarget_ToString(f *testing.F) {
     ^
Cleaning up project directory and file based variables 00:01
ERROR: Job failed: exit code 1

But that does appear to be compiled with Go 1.18?

The .golangci.yml, and the querier_fuzz_test.go for which deadcode raises the error.

@ldez
Copy link
Member

ldez commented Mar 29, 2022

Thank you, I'm able to reproduce the problem, I will fix that quickly.

@ldez ldez removed the feedback required Requires additional feedback label Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants