MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / extractAnnotations

Function extractAnnotations

app/cli/cmd/attestation.go:109–120  ·  view source on GitHub ↗

extractAnnotations extracts the annotations from the flag and returns a map the expected input format is key=value

(annotationsFlag []string)

Source from the content-addressed store, hash-verified

107// extractAnnotations extracts the annotations from the flag and returns a map
108// the expected input format is key=value
109func extractAnnotations(annotationsFlag []string) (map[string]string, error) {
110 var annotations = make(map[string]string)
111 for _, annotation := range annotationsFlag {
112 kv := strings.SplitN(annotation, "=", 2)
113 if len(kv) < 2 {
114 return nil, fmt.Errorf("invalid annotation %q, the format must be key=value", annotation)
115 }
116 annotations[kv[0]] = kv[1]
117 }
118
119 return annotations, nil
120}

Callers 3

newAttestationPushCmdFunction · 0.85
newAttestationAddCmdFunction · 0.85
TestExtractAnnotationsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestExtractAnnotationsFunction · 0.68