mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Enable Go linter gocritic (#26224)
* Chore: Enable gocritic linter Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -173,11 +173,12 @@ func (server *Server) Login(query *models.LoginUserQuery) (
|
||||
var authAndBind bool
|
||||
|
||||
// Check if we can use a search user
|
||||
if server.shouldAdminBind() {
|
||||
switch {
|
||||
case server.shouldAdminBind():
|
||||
if err := server.AdminBind(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if server.shouldSingleBind() {
|
||||
case server.shouldSingleBind():
|
||||
authAndBind = true
|
||||
err = server.UserBind(
|
||||
server.singleBindDN(query.Username),
|
||||
@@ -186,7 +187,7 @@ func (server *Server) Login(query *models.LoginUserQuery) (
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
default:
|
||||
err := server.Connection.UnauthenticatedBind(server.Config.BindDN)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -368,7 +369,7 @@ func (server *Server) getSearchRequest(
|
||||
-1,
|
||||
)
|
||||
|
||||
search = search + query
|
||||
search += query
|
||||
}
|
||||
|
||||
filter := fmt.Sprintf("(|%s)", search)
|
||||
|
||||
@@ -54,13 +54,14 @@ func TestLDAPHelpers(t *testing.T) {
|
||||
|
||||
result := getUsersIteration(logins, func(previous, current int) error {
|
||||
i++
|
||||
if i == 1 {
|
||||
switch i {
|
||||
case 1:
|
||||
So(previous, ShouldEqual, 0)
|
||||
So(current, ShouldEqual, 500)
|
||||
} else if i == 2 {
|
||||
case 2:
|
||||
So(previous, ShouldEqual, 500)
|
||||
So(current, ShouldEqual, 1000)
|
||||
} else {
|
||||
default:
|
||||
So(previous, ShouldEqual, 1000)
|
||||
So(current, ShouldEqual, 1500)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user