MCPcopy Create free account
hub / github.com/containerd/nerdctl / copySpec

Function copySpec

cmd/nerdctl/container/container_update.go:396–410  ·  view source on GitHub ↗
(spec *runtimespec.Spec)

Source from the content-addressed store, hash-verified

394}
395
396func copySpec(spec *runtimespec.Spec) (*runtimespec.Spec, error) {
397 var copySpec runtimespec.Spec
398 if spec == nil {
399 return nil, errors.New("spec cannot be nil")
400 }
401 bytes, err := json.Marshal(spec)
402 if err != nil {
403 return nil, fmt.Errorf("unable to marshal spec: %w", err)
404 }
405 err = json.Unmarshal(bytes, &copySpec)
406 if err != nil {
407 return nil, fmt.Errorf("unable to unmarshal into spec copy: %w", err)
408 }
409 return &copySpec, nil
410}
411
412func updateShellComplete(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
413 return completion.ContainerNames(cmd, nil)

Callers 1

updateContainerFunction · 0.85

Calls 2

MarshalMethod · 0.80
UnmarshalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…