compose-spec / compose-go

Reference library for parsing and loading Compose YAML files
https://compose-spec.io
Apache License 2.0
350 stars 109 forks source link

fix(merge): ensure unique default values for each key in convertIntoMapping #664

Closed idsulik closed 1 month ago

idsulik commented 1 month ago

Fix for this issue https://github.com/docker/compose/issues/11993.

The issue is that we're assigning the same defaultValue map for all keys.

Maps in Go are reference types. If you assign the same map to multiple keys, all keys will point to the same underlying map. Changes to one key will be reflected in all other keys.