We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I believe I may have found a false positive. The following minimum reproduction shows the false positive:
package main import ( "encoding/json" "fmt" ) type Outer struct { Inner Inner `json:"inner"` } type Inner struct { String string } func (i *Inner) UnmarshalJSON(p []byte) error { var s string if err := json.Unmarshal(p, &s); err != nil { return err } i.String = s return nil } func main() { buf := []byte(` { "inner": "my string" } `) var outer Outer if err := json.Unmarshal(buf, &outer); err != nil { panic(err) } fmt.Println(outer) }
The output of the program is:
{{my string}}
See https://go.dev/play/p/HEcyBYmfO_Y
However, musttag with the latest tag (v0.12.1) shows a false positive:
musttag
main.go:32:32: the given struct should be annotated with the `json` tag
It doesn't seem to ignore the absence of JSON tags on the Inner type, even though the Inner type implements the jsonUnmarshaler interface.
Inner
jsonUnmarshaler
The text was updated successfully, but these errors were encountered:
Hi, thank you for the detailed report!
Looks like we only check if a type implements a (un)marshaler interface, but should also do it for a pointer-type.
I'll push the fix soon.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
I believe I may have found a false positive. The following minimum reproduction shows the false positive:
The output of the program is:
See https://go.dev/play/p/HEcyBYmfO_Y
However,
musttag
with the latest tag (v0.12.1) shows a false positive:It doesn't seem to ignore the absence of JSON tags on the
Inner
type, even though theInner
type implements thejsonUnmarshaler
interface.The text was updated successfully, but these errors were encountered: