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

The -exclude option does not seem to work for functions declared in the same package #251

Open
FlorentClarret opened this issue Aug 22, 2024 · 1 comment
Labels

Comments

@FlorentClarret
Copy link

FlorentClarret commented Aug 22, 2024

I have this very simple example:

First file:

package first

func FirstFunc() error {
	return nil
}

func ThirdFunc() error {
	FirstFunc()
	return nil
}

Second file:

package second

import "testerrcheck/first"

func SecondFunc() error {
	first.FirstFunc()
	return nil
}

Exclude file:

testerrcheck/first.FirstFunc

When I run errcheck -exclude exclude.txt ./... I get:

first/file.go:8:11:     FirstFunc()

The exclusion is properly working for the function called in the second package, but not from within its own package, in the first package.

@FlorentClarret FlorentClarret changed the title The -exclude option does not seem to work for functions delcared in the same package The -exclude option does not seem to work for functions declared in the same package Aug 22, 2024
@kisielk
Copy link
Owner

kisielk commented Aug 22, 2024

Thanks, this does indeed seem like a bug

@kisielk kisielk added the bug label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants