-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Allow extended config on cron settings #12939
Allow extended config on cron settings #12939
Conversation
Fix go-gitea#12934 Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #12939 +/- ##
=======================================
Coverage 42.82% 42.82%
=======================================
Files 661 661
Lines 72977 72986 +9
=======================================
+ Hits 31250 31254 +4
- Misses 36658 36660 +2
- Partials 5069 5072 +3
Continue to review full report at Codecov.
|
// GetCronSettings maps the cron subsection to the provided config | ||
func GetCronSettings(name string, config interface{}) (interface{}, error) { | ||
err := Cfg.Section("cron." + name).MapTo(config) | ||
return config, err | ||
if err := Cfg.Section("cron." + name).MapTo(config); err != nil { |
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.
I have 0 experience in Go, but it was hard for me to read this line. I did some research and potentially this may help to avoid such init statements in if with return inside
https://golang.org/doc/effective_go.html#if
In the Go libraries, you'll find that when an if statement doesn't flow into the next statement—that is, the body ends in break, continue, goto, or return—the unnecessary else is omitted.
f, err := os.Open(name)
if err != nil {
return err
}
codeUsing(f)
More to read
https://www.calhoun.io/one-liner-if-statements-with-errors/
Backport go-gitea#12939 Fix go-gitea#12934 Signed-off-by: Andrew Thornton <[email protected]>
Backport #12939 Fix #12934 Signed-off-by: Andrew Thornton <[email protected]>
Workaround odd behaviour in go-ini whereby an embedded field does not get the values from the same section.
Fix #12934
Signed-off-by: Andrew Thornton [email protected]