mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-10-21 10:17:22 +02:00
Some code improvements
* Remove shadowing of predeclared identifier: new. * strings.ReplaceAll instead of strings.Replace with -1. * Change strings.ToLower comparison to strings.EqualFold. * Rewrite if-else-if-else chain as a switch.
This commit is contained in:
+1
-1
@@ -40,7 +40,7 @@ func (cfg EnvOptions) LoadEnvForStruct(options interface{}) {
|
||||
envName := field.Tag.Get("env")
|
||||
cfgName := field.Tag.Get("cfg")
|
||||
if cfgName == "" && flagName != "" {
|
||||
cfgName = strings.Replace(flagName, "-", "_", -1)
|
||||
cfgName = strings.ReplaceAll(flagName, "-", "_")
|
||||
}
|
||||
if envName == "" || cfgName == "" {
|
||||
// resolvable fields must have the `env` and `cfg` struct tag
|
||||
|
||||
Reference in New Issue
Block a user