-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
structcheck returns false positives for embedded structs #826
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
Labels
false positive
An error is reported when one does not exist
Comments
We see the same thing in gonum/gonum. Locally, this looks like this:
This field is used embedded. |
Self-contained example, extracted from https://github.com/rillig/pkglint: package main
import "fmt"
type Autofix struct {
autofixShortTerm // embedded with implicit name
}
type autofixShortTerm struct {
actions []string
}
func (a *Autofix) PrintActions() {
for _, action := range a.actions { // obviously used
fmt.Println(action)
}
}
func main() {
fix := Autofix{}
fix.actions = append(fix.actions, "action") // obviously used as well
fix.PrintActions()
} Output:
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been minimized.
This comment has been minimized.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This was referenced Jun 14, 2022
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
structcheck is deprecated, please stop using it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for creating the issue!
Please include the following information:
Version of golangci-lint
$ golangci-lint --version golangci-lint has version v1.21.0 built from (unknown, mod sum: "h1:HxAxpR8Z0M8omihvQdsD3PF0qPjlqYqp2vMJzstoKeI=") on (unknown)
Config file
Go environment
See false positives here: https://github.com/VictoriaMetrics/VictoriaMetrics/commit/97ce4e03a57825a783a28e25fc88b9a9e9e09c3c/checks?check_suite_id=269491276
The text was updated successfully, but these errors were encountered: