Skip to content

Commit fe3cc22

Browse files
committed
Fix faulty json.Marshal behavior for embeds types.NetConf
Signed-off-by: Tomofumi Hayashi <[email protected]>
1 parent cebd7df commit fe3cc22

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/types/types.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ func (n *IPNet) UnmarshalJSON(data []byte) error {
5656
return nil
5757
}
5858

59-
// NetConf describes a network.
60-
type NetConf struct {
59+
// NetConfType describes a network.
60+
type NetConfType struct {
6161
CNIVersion string `json:"cniVersion,omitempty"`
6262

6363
Name string `json:"name,omitempty"`
@@ -73,6 +73,9 @@ type NetConf struct {
7373
ValidAttachments []GCAttachment `json:"cni.dev/valid-attachments,omitempty"`
7474
}
7575

76+
// NetConf is defined as different type as custom MarshalJSON() and issue #1096
77+
type NetConf NetConfType
78+
7679
// GCAttachment is the parameters to a GC call -- namely,
7780
// the container ID and ifname pair that represents a
7881
// still-valid attachment.

0 commit comments

Comments
 (0)