summaryrefslogtreecommitdiffstats
path: root/modules/auth
diff options
context:
space:
mode:
authorkolaente <konrad@kola-entertainments.de>2019-06-12 21:41:28 +0200
committertechknowlogick <techknowlogick@gitea.io>2019-06-12 15:41:28 -0400
commitf9ec2f89f2265bc1371a6c62359de9816534fa6b (patch)
treef48b138a457e5ac6cf843bbb38400926704370f7 /modules/auth
parent5832f8d90df2d72cb38698c3e9050f2b29717dc7 (diff)
downloadgitea-f9ec2f89f2265bc1371a6c62359de9816534fa6b.tar.gz
gitea-f9ec2f89f2265bc1371a6c62359de9816534fa6b.zip
Add golangci (#6418)
Diffstat (limited to 'modules/auth')
-rw-r--r--modules/auth/auth.go12
-rw-r--r--modules/auth/oauth2/oauth2.go3
-rw-r--r--modules/auth/openid/discovery_cache_test.go2
-rw-r--r--modules/auth/user_form.go2
4 files changed, 5 insertions, 14 deletions
diff --git a/modules/auth/auth.go b/modules/auth/auth.go
index edb596c240..2a2ee40492 100644
--- a/modules/auth/auth.go
+++ b/modules/auth/auth.go
@@ -214,10 +214,8 @@ func SignedInUser(ctx *macaron.Context, sess session.Store) (*models.User, bool)
if err = models.UpdateAccessToken(token); err != nil {
log.Error("UpdateAccessToken: %v", err)
}
- } else {
- if !models.IsErrAccessTokenNotExist(err) && !models.IsErrAccessTokenEmpty(err) {
- log.Error("GetAccessTokenBySha: %v", err)
- }
+ } else if !models.IsErrAccessTokenNotExist(err) && !models.IsErrAccessTokenEmpty(err) {
+ log.Error("GetAccessTokenBySha: %v", err)
}
if u == nil {
@@ -301,12 +299,6 @@ func GetInclude(field reflect.StructField) string {
return getRuleBody(field, "Include(")
}
-// FIXME: struct contains a struct
-func validateStruct(obj interface{}) binding.Errors {
-
- return nil
-}
-
func validate(errs binding.Errors, data map[string]interface{}, f Form, l macaron.Locale) binding.Errors {
if errs.Len() == 0 {
return errs
diff --git a/modules/auth/oauth2/oauth2.go b/modules/auth/oauth2/oauth2.go
index 5684f44a89..a2d7116211 100644
--- a/modules/auth/oauth2/oauth2.go
+++ b/modules/auth/oauth2/oauth2.go
@@ -220,8 +220,7 @@ func GetDefaultProfileURL(provider string) string {
// GetDefaultEmailURL return the default email url for the given provider
func GetDefaultEmailURL(provider string) string {
- switch provider {
- case "github":
+ if provider == "github" {
return github.EmailURL
}
return ""
diff --git a/modules/auth/openid/discovery_cache_test.go b/modules/auth/openid/discovery_cache_test.go
index 2e37058cc3..931e5c7945 100644
--- a/modules/auth/openid/discovery_cache_test.go
+++ b/modules/auth/openid/discovery_cache_test.go
@@ -39,7 +39,7 @@ func TestTimedDiscoveryCache(t *testing.T) {
t.Errorf("Expected nil, got %v", di)
}
- // Sleep one second and try retrive again
+ // Sleep one second and try retrieve again
time.Sleep(1 * time.Second)
if di := dc.Get("foo"); di != nil {
diff --git a/modules/auth/user_form.go b/modules/auth/user_form.go
index 8b9e5877d9..0c8bd30abc 100644
--- a/modules/auth/user_form.go
+++ b/modules/auth/user_form.go
@@ -253,7 +253,7 @@ func (f UpdateThemeForm) IsThemeExists() bool {
var exists bool
for _, v := range setting.UI.Themes {
- if strings.ToLower(v) == strings.ToLower(f.Theme) {
+ if strings.EqualFold(v, f.Theme) {
exists = true
break
}