1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-06-25 00:47:17 +02:00

Add new linters (#486)

* add new linters and fix issues

* fix deprecated warnings

* simplify return

* update CHANGELOG

* fix staticcheck issues

* remove a deprecated linter, minor fixes of variable initialization
This commit is contained in:
Mitsuo Heijo
2020-04-14 17:36:44 +09:00
committed by GitHub
parent 4341ab4420
commit dd05e7ff0b
21 changed files with 88 additions and 79 deletions

View File

@ -290,7 +290,7 @@ func (o *Options) Validate() error {
}
}
if o.PreferEmailToUser == true && o.PassBasicAuth == false && o.PassUserHeaders == false {
if o.PreferEmailToUser && !o.PassBasicAuth && !o.PassUserHeaders {
msgs = append(msgs, "PreferEmailToUser should only be used with PassBasicAuth or PassUserHeaders")
}
@ -349,7 +349,7 @@ func (o *Options) Validate() error {
if string(secretBytes(o.CookieSecret)) != o.CookieSecret {
decoded = true
}
if validCookieSecretSize == false {
if !validCookieSecretSize {
var suffix string
if decoded {
suffix = fmt.Sprintf(" note: cookie secret was base64 decoded from %q", o.CookieSecret)
@ -414,7 +414,7 @@ func (o *Options) Validate() error {
msgs = setupLogger(o, msgs)
if len(msgs) != 0 {
return fmt.Errorf("Invalid configuration:\n %s",
return fmt.Errorf("invalid configuration:\n %s",
strings.Join(msgs, "\n "))
}
return nil
@ -545,7 +545,7 @@ func parseSignatureKey(o *Options, msgs []string) []string {
// parseJwtIssuers takes in an array of strings in the form of issuer=audience
// and parses to an array of jwtIssuer structs.
func parseJwtIssuers(issuers []string, msgs []string) ([]jwtIssuer, []string) {
var parsedIssuers []jwtIssuer
parsedIssuers := make([]jwtIssuer, 0, len(issuers))
for _, jwtVerifier := range issuers {
components := strings.Split(jwtVerifier, "=")
if len(components) < 2 {