MCPcopy
hub / github.com/opencontainers/runc / SearchLabels

Function SearchLabels

libcontainer/utils/utils.go:40–48  ·  view source on GitHub ↗

SearchLabels searches through a list of key=value pairs for a given key, returning its value, and the binary flag telling whether the key exist.

(labels []string, key string)

Source from the content-addressed store, hash-verified

38// SearchLabels searches through a list of key=value pairs for a given key,
39// returning its value, and the binary flag telling whether the key exist.
40func SearchLabels(labels []string, key string) (string, bool) {
41 key += "="
42 for _, s := range labels {
43 if val, ok := strings.CutPrefix(s, key); ok {
44 return val, true
45 }
46 }
47 return "", false
48}
49
50// Annotations returns the bundle path and user defined annotations from the
51// libcontainer state. We need to remove the bundle because that is a label

Callers 3

getProcessFunction · 0.92
TestSearchLabelsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestSearchLabelsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…