Skip to content

Commit

Permalink
Fix faulty json.Marshal behavior for embeds types.NetConf
Browse files Browse the repository at this point in the history
  • Loading branch information
s1061123 committed Jun 3, 2024
1 parent cebd7df commit f9c2a15
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func (n *IPNet) UnmarshalJSON(data []byte) error {
return nil
}

// NetConf describes a network.
type NetConf struct {
// NetConfType describes a network.
type NetConfType struct {
CNIVersion string `json:"cniVersion,omitempty"`

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

// NetConf is defined as different type as custom MarshalJSON() and issue #1096
type NetConf NetConfType

// GCAttachment is the parameters to a GC call -- namely,
// the container ID and ifname pair that represents a
// still-valid attachment.
Expand Down

0 comments on commit f9c2a15

Please sign in to comment.