From 5afca6ca8eaadebc613dce291da2bae1030ccca9 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 6 Mar 2022 16:33:55 +0800 Subject: autofix: function call can be replaced with helper function (#6805) Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> --- internal/auth/ldap/config.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'internal/auth') diff --git a/internal/auth/ldap/config.go b/internal/auth/ldap/config.go index db666cde..79840ee4 100644 --- a/internal/auth/ldap/config.go +++ b/internal/auth/ldap/config.go @@ -72,7 +72,7 @@ func (c *Config) sanitizedUserQuery(username string) (string, bool) { return "", false } - return strings.Replace(c.Filter, "%s", username, -1), true + return strings.ReplaceAll(c.Filter, "%s", username), true } func (c *Config) sanitizedUserDN(username string) (string, bool) { @@ -83,7 +83,7 @@ func (c *Config) sanitizedUserDN(username string) (string, bool) { return "", false } - return strings.Replace(c.UserDN, "%s", username, -1), true + return strings.ReplaceAll(c.UserDN, "%s", username), true } func (c *Config) sanitizedGroupFilter(group string) (string, bool) { @@ -112,7 +112,7 @@ func (c *Config) findUserDN(l *ldap.Conn, name string) (string, bool) { log.Trace("Search for LDAP user: %s", name) if len(c.BindDN) > 0 && len(c.BindPassword) > 0 { // Replace placeholders with username - bindDN := strings.Replace(c.BindDN, "%s", name, -1) + bindDN := strings.ReplaceAll(c.BindDN, "%s", name) err := l.Bind(bindDN, c.BindPassword) if err != nil { log.Trace("LDAP: Failed to bind as BindDN '%s': %v", bindDN, err) -- cgit v1.2.3