Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialize Go model back to file #135

Closed
marcauberer opened this issue Apr 29, 2021 · 3 comments
Closed

Serialize Go model back to file #135

marcauberer opened this issue Apr 29, 2021 · 3 comments
Labels
question Further information is requested

Comments

@marcauberer
Copy link

Hi,
is it possible to serialize the Go models back to compose files? If yes, how can this be achieved?

Thanks in advance

@ndeloof ndeloof added the question Further information is requested label Jun 10, 2021
@ndeloof
Copy link
Collaborator

ndeloof commented Jun 10, 2021

this is indeed a supported usage, that is used for Docker Compose v2: https://github.com/docker/compose-cli/blob/main/local/compose/compose.go#L69-L72

@ndeloof ndeloof closed this as completed Jun 10, 2021
@ZhuonanLin
Copy link

Hi there, I am dealing with the same situation in my case, i.e., I want to convert a Go ServiceConfig struct to yaml compose file, the link above is invalid, can you please give me a new reference? Thanks!

@ndeloof
Copy link
Collaborator

ndeloof commented Apr 5, 2023

You just need to run yaml.Marshal(project) to get a compose-go project serialized to yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants