-
Notifications
You must be signed in to change notification settings - Fork 86
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: load config error #1145
fix: load config error #1145
Conversation
Signed-off-by: Junjie Gao <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1145 +/- ##
==========================================
- Coverage 72.52% 72.38% -0.14%
==========================================
Files 50 50
Lines 3126 3125 -1
==========================================
- Hits 2267 2262 -5
- Misses 667 670 +3
- Partials 192 193 +1 ☔ View full report in Codecov by Sentry. |
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.
Can you re-implement LoadConfigOnce
using sync.OnceValues?
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
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
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.
Let's make
notation/internal/cmd/flags.go
Line 46 in 1118964
SetPflagSignatureFormat = func(fs *pflag.FlagSet, p *string) { |
SetPflagSignatureFormat = func(fs *pflag.FlagSet, p *string) {
config, err := configutil.LoadConfigOnce()
if err != nil || config.SignatureFormat == "" {
fs.StringVar(p, PflagSignatureFormat.Name, envelope.JWS, PflagSignatureFormat.Usage)
return
}
// set signatureFormat from config
fs.StringVar(p, PflagSignatureFormat.Name, config.SignatureFormat, PflagSignatureFormat.Usage)
}
Signed-off-by: Junjie Gao <[email protected]>
Updated. |
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
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
Fix:
LoadConfigOnce
function forgets the error and return a nil config and nil error next time. Updated to usesync.OnceValues
to keep the returned values.Resolves #1144