File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -64,9 +64,7 @@ func FromDiscoverer(d discover.Discover) (*cdi.ContainerEdits, error) {
6464 return nil , fmt .Errorf ("failed to discover hooks: %v" , err )
6565 }
6666
67- c := cdi.ContainerEdits {
68- ContainerEdits : & specs.ContainerEdits {},
69- }
67+ c := NewContainerEdits ()
7068 for _ , d := range devices {
7169 edits , err := device (d ).toEdits ()
7270 if err != nil {
@@ -83,7 +81,15 @@ func FromDiscoverer(d discover.Discover) (*cdi.ContainerEdits, error) {
8381 c .Append (hook (h ).toEdits ())
8482 }
8583
86- return & c , nil
84+ return c , nil
85+ }
86+
87+ // NewContainerEdits is a utility function to create a CDI ContainerEdits struct.
88+ func NewContainerEdits () * cdi.ContainerEdits {
89+ c := cdi.ContainerEdits {
90+ ContainerEdits : & specs.ContainerEdits {},
91+ }
92+ return & c
8793}
8894
8995// Modify applies the defined edits to the incoming OCI spec
You can’t perform that action at this time.
0 commit comments