You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-12-01 22:51:45 +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:
@@ -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