docker / libcompose

*Unmaintained/Deprecated* An experimental go library providing Compose-like functionality
https://godoc.org/github.com/docker/libcompose
Apache License 2.0
585 stars 191 forks source link

libcompose differentiating between version 2 and version 2.0 #514

Open prashanthjbabu opened 5 years ago

prashanthjbabu commented 5 years ago

According to documentation https://docs.docker.com/compose/compose-file/compose-versioning/#version-2 . Version 2 and 2.0 are meant to be the same although libcompose seems to be treating them differently throwing out a different config whenever the API project.Config() is called. Example : 1)

prash@prash-laptop:/tmp/testcompose$ cat test.yml {"services":{"helloworld":{"container_name":"helloworld","image":"tutum/hello-world" }},"version":"2"} prash@prash-laptop:/tmp/testcompose$ go run test.go version: "2.0" services: helloworld: container_name: helloworld image: tutum/hello-world networks: default: {} volumes: {} networks: default: {}

2)

prash@prash-laptop:/tmp/testcompose$ cat test.yml {"services":{"helloworld":{"container_name":"helloworld","image":"tutum/hello-world" }},"version":"2.0"} prash@prash-laptop:/tmp/testcompose$ go run test.go version: "2.0" services: helloworld: container_name: helloworld image: tutum/hello-world volumes: {} networks: {}

The outputs for example 1 and 2 are different even though the versions for case 1 and 2 are the same except that they were represented as 2 and 2.0 respectively.