From f9c2a1517436041dd54924ab638487d53182dd19 Mon Sep 17 00:00:00 2001 From: Tomofumi Hayashi Date: Tue, 4 Jun 2024 03:00:18 +0900 Subject: [PATCH] Fix faulty json.Marshal behavior for embeds types.NetConf --- pkg/types/types.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/types/types.go b/pkg/types/types.go index 193ac46e..555d7e9f 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -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"` @@ -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.