-
Notifications
You must be signed in to change notification settings - Fork 32
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
fix for empty default value #66
Conversation
Codecov Report
@@ Coverage Diff @@
## main #66 +/- ##
==========================================
+ Coverage 92.22% 92.24% +0.02%
==========================================
Files 3 3
Lines 360 361 +1
==========================================
+ Hits 332 333 +1
Misses 23 23
Partials 5 5
Continue to review full report at Codecov.
|
The field AllFieldRequired will not work in the example code type MyConfig struct {
Port int `usage:"just give a number"`
Auth struct {
User string `default:"def-user"`
Pass string `default:"def-pass"`
}
Pass string `flag:"sec_ret" required:"true"`
}
var cfg MyConfig
loader := aconfig.LoaderFor(&cfg, aconfig.Config{
AllFieldRequired: true,
// SkipDefaults: true,
})
if err := loader.Load(); err != nil {
panic(err)
}
log.Println(cfg) |
Hi, I don't get what you're expecting. Is this related to this line? https://github.com/cristalhq/aconfig/blob/main/aconfig.go#L48 |
@cristaloleg Yes, the option |
The code in PR is not the best way to fix it. |
I don't mean it's incorrect, I'm asking |
Yes, I have already answered. Have you do any testing on the behavior of |
Now it's better, you haven't mentioned |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thanks 🎉 |
No description provided.