mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-21 21:30:48 +02:00
fix go 1.18 compat
This commit is contained in:
parent
77a46ab3bd
commit
08d2f3ee1f
1 changed files with 5 additions and 2 deletions
|
@ -4,11 +4,14 @@ import "strings"
|
||||||
|
|
||||||
type imageMeta map[string]string
|
type imageMeta map[string]string
|
||||||
|
|
||||||
|
const openContainersPrefix = "org.opencontainers.image."
|
||||||
|
|
||||||
func imageMetaFromLabels(labels map[string]string) imageMeta {
|
func imageMetaFromLabels(labels map[string]string) imageMeta {
|
||||||
im := make(imageMeta)
|
im := make(imageMeta)
|
||||||
for key, value := range labels {
|
for key, value := range labels {
|
||||||
if suffix, found := strings.CutPrefix(key, "org.opencontainers.image."); found {
|
if strings.HasPrefix(key, openContainersPrefix) {
|
||||||
im[suffix] = value
|
strippedKey := key[len(openContainersPrefix):]
|
||||||
|
im[strippedKey] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return im
|
return im
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue