mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
bump compose-go to v2.2.0
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
33
vendor/github.com/compose-spec/compose-go/v2/override/uncity.go
generated
vendored
33
vendor/github.com/compose-spec/compose-go/v2/override/uncity.go
generated
vendored
@ -36,7 +36,6 @@ func init() {
|
||||
unique["services.*.annotations"] = keyValueIndexer
|
||||
unique["services.*.build.args"] = keyValueIndexer
|
||||
unique["services.*.build.additional_contexts"] = keyValueIndexer
|
||||
unique["services.*.build.extra_hosts"] = keyValueIndexer
|
||||
unique["services.*.build.platform"] = keyValueIndexer
|
||||
unique["services.*.build.tags"] = keyValueIndexer
|
||||
unique["services.*.build.labels"] = keyValueIndexer
|
||||
@ -51,7 +50,6 @@ func init() {
|
||||
unique["services.*.environment"] = keyValueIndexer
|
||||
unique["services.*.env_file"] = envFileIndexer
|
||||
unique["services.*.expose"] = exposeIndexer
|
||||
unique["services.*.extra_hosts"] = keyValueIndexer
|
||||
unique["services.*.labels"] = keyValueIndexer
|
||||
unique["services.*.links"] = keyValueIndexer
|
||||
unique["services.*.networks.*.aliases"] = keyValueIndexer
|
||||
@ -62,6 +60,7 @@ func init() {
|
||||
unique["services.*.sysctls"] = keyValueIndexer
|
||||
unique["services.*.tmpfs"] = keyValueIndexer
|
||||
unique["services.*.volumes"] = volumeIndexer
|
||||
unique["services.*.devices"] = deviceMappingIndexer
|
||||
}
|
||||
|
||||
// EnforceUnicity removes redefinition of elements declared in a sequence
|
||||
@ -108,16 +107,16 @@ func enforceUnicity(value any, p tree.Path) (any, error) {
|
||||
return value, nil
|
||||
}
|
||||
|
||||
func keyValueIndexer(y any, p tree.Path) (string, error) {
|
||||
switch value := y.(type) {
|
||||
func keyValueIndexer(v any, p tree.Path) (string, error) {
|
||||
switch value := v.(type) {
|
||||
case string:
|
||||
key, _, found := strings.Cut(value, "=")
|
||||
if !found {
|
||||
return value, nil
|
||||
if found {
|
||||
return key, nil
|
||||
}
|
||||
return key, nil
|
||||
return value, nil
|
||||
default:
|
||||
return "", fmt.Errorf("%s: unexpected type %T", p, y)
|
||||
return "", fmt.Errorf("%s: unexpected type %T", p, v)
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,6 +138,24 @@ func volumeIndexer(y any, p tree.Path) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func deviceMappingIndexer(y any, p tree.Path) (string, error) {
|
||||
switch value := y.(type) {
|
||||
case map[string]any:
|
||||
target, ok := value["target"].(string)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("service device %s is missing a mount target", p)
|
||||
}
|
||||
return target, nil
|
||||
case string:
|
||||
arr := strings.Split(value, ":")
|
||||
if len(arr) == 1 {
|
||||
return arr[0], nil
|
||||
}
|
||||
return arr[1], nil
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func exposeIndexer(a any, path tree.Path) (string, error) {
|
||||
switch v := a.(type) {
|
||||
case string:
|
||||
|
Reference in New Issue
Block a user