Add gocritic

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
This commit is contained in:
m.nabokikh
2020-10-18 01:54:27 +04:00
parent 4d63e9cd68
commit 1d83e4749d
17 changed files with 99 additions and 97 deletions

View File

@@ -34,7 +34,7 @@ func (m *callback) LoginURL(s connector.Scopes, callbackURL, state string) (stri
if err != nil {
return "", fmt.Errorf("failed to parse callbackURL %q: %v", callbackURL, err)
}
u.Path = u.Path + m.pathSuffix
u.Path += m.pathSuffix
v := u.Query()
v.Set("state", state)
u.RawQuery = v.Encode()

View File

@@ -334,11 +334,12 @@ func (c *githubConnector) Refresh(ctx context.Context, s connector.Scopes, ident
// getGroups retrieves GitHub orgs and teams a user is in, if any.
func (c *githubConnector) getGroups(ctx context.Context, client *http.Client, groupScope bool, userLogin string) ([]string, error) {
if len(c.orgs) > 0 {
switch {
case len(c.orgs) > 0:
return c.groupsForOrgs(ctx, client, userLogin)
} else if c.org != "" {
case c.org != "":
return c.teamsForOrg(ctx, client, c.org)
} else if groupScope && c.loadAllGroups {
case groupScope && c.loadAllGroups:
return c.userGroups(ctx, client)
}
return nil, nil

View File

@@ -188,7 +188,7 @@ func parseScope(s string) (int, bool) {
// See "Config.GroupSearch.UserMatchers" comments for the details
func (c *ldapConnector) userMatchers() []UserMatcher {
if len(c.GroupSearch.UserMatchers) > 0 && c.GroupSearch.UserMatchers[0].UserAttr != "" {
return c.GroupSearch.UserMatchers[:]
return c.GroupSearch.UserMatchers
}
return []UserMatcher{
@@ -245,9 +245,9 @@ func (c *Config) openConnector(logger log.Logger) (*ldapConnector, error) {
if host, _, err = net.SplitHostPort(c.Host); err != nil {
host = c.Host
if c.InsecureNoSSL {
c.Host = c.Host + ":389"
c.Host += ":389"
} else {
c.Host = c.Host + ":636"
c.Host += ":636"
}
}