Debian Codegraph @

go/analysis/passes/modernize/testdata/src/omitzero/omitzero.go

raw
1 package omitzero
2
3 type Foo struct {
4 EmptyStruct struct{} `json:",omitempty"` // want "Omitempty has no effect on nested struct fields"
5 }
6
7 type Bar struct {
8 NonEmptyStruct struct{ a int } `json:",omitempty"` // want "Omitempty has no effect on nested struct fields"
9 }
10
11 type C struct {
12 D string `json:",omitempty"`
13 }
14
15 type R struct {
16 M string `json:",omitempty"`
17 }
18
19 type A struct {
20 C C `json:"test,omitempty"` // want "Omitempty has no effect on nested struct fields"
21 R R `json:"test"`
22 }
23
24 type X struct {
25 NonEmptyStruct struct{ a int } `json:",omitempty" yaml:",omitempty"` // want "Omitempty has no effect on nested struct fields"
26 }
27
28 type Y struct {
29 NonEmptyStruct struct{ a int } `yaml:",omitempty" json:",omitempty"` // want "Omitempty has no effect on nested struct fields"
30 }