Skip to content

Supress not used test & benchmark functions #109

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

Closed
rekby opened this issue Jun 15, 2018 · 4 comments
Closed

Supress not used test & benchmark functions #109

rekby opened this issue Jun 15, 2018 · 4 comments
Labels
false positive An error is reported when one does not exist

Comments

@rekby
Copy link

rekby commented Jun 15, 2018

_test.go files have Benchmark... and Test... functions - it isn't use in main program and linters warning many times about dead code.

I think these errors have to be supress by default for these functions.

@jirfag jirfag added the false positive An error is reported when one does not exist label Jun 15, 2018
@jirfag
Copy link
Contributor

jirfag commented Jun 15, 2018

Thank you, it looks like a bug of linters, can you give more information? Maybe you can give minimal reproducible example or full file?
In all repos I’ve tested it doesn’t report about test functions

@jirfag jirfag added the question Further information is requested label Jun 15, 2018
@rekby
Copy link
Author

rekby commented Jun 26, 2018

Minimal example:

bug repeated for file test_test.go

package main

import "testing"

func TestTest(t *testing.T) {

}
golangci-lint --version
golangci-lint has version 1.7.2 built from 93311ae on 2018-06-19T13:43:26Z

golangci-lint run
test_test.go:5:6: `TestTest` is unused (deadcode)
func TestTest(t *testing.T) {
     ^

golangci pushed a commit that referenced this issue Jun 28, 2018
@jirfag jirfag removed the question Further information is requested label Jun 28, 2018
@jirfag jirfag closed this as completed in 88ebabc Jun 28, 2018
@IvanBoyko
Copy link

Still not fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false positive An error is reported when one does not exist
Projects
None yet
Development

No branches or pull requests

3 participants