structcheck false positive when field is referenced in another package, but not the package struct is defined in.
I have a package that defines a struct, and a function involving that struct:
type SomeStruct struct {
SomeField string `json:"some_field"`
// ...
}
func SetResponse(resp SomeStruct, w http.ResponseWriter) {
body, err := json.Marshal(resp)
// ...
w.WriteHeader(http.StatusOK)
w.Write(body)
}
That function is called from other packages, like so:
somepackage.SetResponse(somepackage.SomeStruct{SomeField:"some_value"}, w)
Despite the fact that SomeField
is explicitly used, structcheck
calls shenanigans on me when invoked as:
structcheck -e ./...
Am I simply misunderstanding what structcheck is meant to be checking, or is this a bug? Is there a way I can flag this as not being a real issue, so I can continue using structcheck?