mirror of
https://github.com/anchore/syft.git
synced 2026-11-02 23:46:35 +01:00
translate maps to sequences in pkg metadata (#2553)
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package pkg
|
||||
|
||||
type KeyValue struct {
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
type KeyValues []KeyValue
|
||||
|
||||
func (k KeyValues) Get(key string) (string, bool) {
|
||||
for _, kv := range k {
|
||||
if kv.Key == key {
|
||||
return kv.Value, true
|
||||
}
|
||||
}
|
||||
|
||||
return "", false
|
||||
}
|
||||
|
||||
func (k KeyValues) MustGet(key string) string {
|
||||
for _, kv := range k {
|
||||
if kv.Key == key {
|
||||
return kv.Value
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
Reference in New Issue
Block a user