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

Write struct to file #93

Open
kratofl opened this issue Jul 21, 2024 · 2 comments
Open

Write struct to file #93

kratofl opened this issue Jul 21, 2024 · 2 comments

Comments

@kratofl
Copy link

kratofl commented Jul 21, 2024

Question
Is there a way to create a pkl file with a struct?

Context
I would like to create a default configuration file from a struct if my application runs for the first time.

Example?
From the stdlib there is a possibility to create json file out of a struct json.MarshalIndent(defaultCfg, "", " ").

@HT154
Copy link
Contributor

HT154 commented Jul 22, 2024

This is not something that exists today. This sort of workflow makes sense to me in principle, but even in simple cases it's not entirely clear what the correct behavior would be. See #46 for more general discussion on this topic.

@kratofl
Copy link
Author

kratofl commented Jul 28, 2024

Thank you.
I get the problem, I think in those cases where it could work would be something = value instead of idk something = (variable + 5).
I mean there could be a option using struct tags. It would definitely increase the complexity and I'm not sure if this would work for all use cases. Was just something that came straight into my head.

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

No branches or pull requests

2 participants