-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[WIP] docs: script for generating config docs #4292
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Woradorn Laodhanadhaworn <[email protected]>
Heya @lookharm 👋 Thanks so much for giving this a go - nice work so far! 🎉 The only thing that you don't have there that I think would be really nice would be a way of printing out values from the target BTW - if you don't mind me asking, how did you come across the issue? I genuinely wasn't expecting anyone to pick it up so soon, so thanks!
The logic in I'm not sure where the little tool to do this would be though - for now, feel free to put it anywhere (like under Then we'd just do something like this in
|
Thanks for the response. After thinking about this.
According to type Config struct {
Debug true `toml: "debug", comment: "Debug is bool"`
}
func main() {
out, _ := toml.Marshal(Config{Debug: true})
fmt.Println(string(out))
} The output is: # Debug is bool
debug = true This way, it is easier and doesn't require any TOML parsing that go-toml package has done.
I often use Docker and just want to learn more about how the internal works, I hope the contributions will help me, and I think the buildkit is a good starting point. If any issues that you see are good for the starter, please tell me. |
Ahhh the TOML marshaller would be nice - but, I don't really like the pattern of reading the comments from a separate field. It means everything has to be in a sine line, which is not very easy to read or edit. If we could keep the comments as go-style doc comments, I think using the TOML marshaller would be perfect! That said, I'd be happy to be persuaded if there's really no easy way to do this in code. |
@lookharm just wanted to check-in - are you blocked on this, anything you need help with from our end? No rush, I've just been thinking about improving the config docs as well, and this was on-theme with that. |
This pr introduces an initial solution to extract comments associated with a Config struct and then generate the config docs. The current implementation only supports single-level structs; nested structs are not supported yet. It will solve issue #4274. If this initial approach is accepted, I plan to make it complete.
A few questions to make it clearer:
(cc @jedevc)