浏览代码

pkg/middleware/middleware.go: Fix empty branch warning.

See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=megacheck ./...
pkg/middleware/middleware.go:46:3:warning: empty branch (SA9003) (megacheck)
Mario Trangoni 7 年之前
父节点
当前提交
e673337cb9
共有 1 个文件被更改,包括 7 次插入6 次删除
  1. 7 6
      pkg/middleware/middleware.go

+ 7 - 6
pkg/middleware/middleware.go

@@ -43,12 +43,13 @@ func GetContextHandler() macaron.Handler {
 		// then init session and look for userId in session
 		// then look for api key in session (special case for render calls via api)
 		// then test if anonymous access is enabled
-		if initContextWithRenderAuth(ctx) ||
-			initContextWithApiKey(ctx) ||
-			initContextWithBasicAuth(ctx, orgId) ||
-			initContextWithAuthProxy(ctx, orgId) ||
-			initContextWithUserSessionCookie(ctx, orgId) ||
-			initContextWithAnonymousUser(ctx) {
+		switch {
+		case initContextWithRenderAuth(ctx):
+		case initContextWithApiKey(ctx):
+		case initContextWithBasicAuth(ctx, orgId):
+		case initContextWithAuthProxy(ctx, orgId):
+		case initContextWithUserSessionCookie(ctx, orgId):
+		case initContextWithAnonymousUser(ctx):
 		}
 
 		ctx.Logger = log.New("context", "userId", ctx.UserId, "orgId", ctx.OrgId, "uname", ctx.Login)