code: func updateMetadata(specAnnotations map[string]string, name string) string {
  	oldMetadata := specAnnotations[annotations.Metadata]
  	containerType := specAnnotations[annotations.ContainerType]
  	switch containerType {
  	case "container":
  		metadata := runtime.ContainerMetadata{}
  		err := json.Unmarshal([]byte(oldMetadata), &metadata)
  		if err != nil {
  			return oldMetadata
  		}
  		metadata.Name = name
  		m, err := json.Marshal(metadata)
  		if err != nil {
  			return oldMetadata
  		}
  		return string(m)
  
  	case "sandbox":
  		metadata := runtime.PodSandboxMetadata{}
  		err := json.Unmarshal([]byte(oldMetadata), &metadata)
  		if err != nil {
  			return oldMetadata
  		}
  		metadata.Name = name
  		m, err := json.Marshal(metadata)
  		if err != nil {
  			return oldMetadata
  		}
  		return string(m)
  
  	default:
  		return specAnnotations[annotations.Metadata]
  	}
  }
docs: // Attempts to update a metadata annotation