From 28a5bc313a36d761a020ee26f1e011f91f36cbb2 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Fri, 3 Mar 2017 16:21:31 +0800 Subject: [PATCH] fix: gofmt errors. (#1106) --- modules/auth/auth.go | 4 ++-- modules/auth/auth_form.go | 2 +- modules/auth/oauth2/oauth2.go | 12 +++++++----- modules/markdown/markdown_test.go | 20 ++++++++++---------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/modules/auth/auth.go b/modules/auth/auth.go index 4a31ff944e..33ba777966 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -179,7 +179,7 @@ func AssignForm(form interface{}, data map[string]interface{}) { func getRuleBody(field reflect.StructField, prefix string) string { for _, rule := range strings.Split(field.Tag.Get("binding"), ";") { if strings.HasPrefix(rule, prefix) { - return rule[len(prefix): len(rule) - 1] + return rule[len(prefix) : len(rule)-1] } } return "" @@ -237,7 +237,7 @@ func validate(errs binding.Errors, data map[string]interface{}, f Form, l macaro } if errs[0].FieldNames[0] == field.Name { - data["Err_" + field.Name] = true + data["Err_"+field.Name] = true trName := field.Tag.Get("locale") if len(trName) == 0 { diff --git a/modules/auth/auth_form.go b/modules/auth/auth_form.go index 5dae55c1ef..338be53457 100644 --- a/modules/auth/auth_form.go +++ b/modules/auth/auth_form.go @@ -37,7 +37,7 @@ type AuthenticationForm struct { SkipVerify bool PAMServiceName string Oauth2Provider string - Oauth2Key string + Oauth2Key string Oauth2Secret string } diff --git a/modules/auth/oauth2/oauth2.go b/modules/auth/oauth2/oauth2.go index bf486d5a0b..ca4cde73b6 100644 --- a/modules/auth/oauth2/oauth2.go +++ b/modules/auth/oauth2/oauth2.go @@ -5,16 +5,18 @@ package oauth2 import ( - "code.gitea.io/gitea/modules/setting" + "net/http" + "os" + "path/filepath" + "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/setting" + "github.com/gorilla/sessions" "github.com/markbates/goth" "github.com/markbates/goth/gothic" - "net/http" - "os" - "github.com/satori/go.uuid" - "path/filepath" "github.com/markbates/goth/providers/github" + "github.com/satori/go.uuid" ) var ( diff --git a/modules/markdown/markdown_test.go b/modules/markdown/markdown_test.go index 403035bdf0..88d289aa0e 100644 --- a/modules/markdown/markdown_test.go +++ b/modules/markdown/markdown_test.go @@ -463,7 +463,7 @@ func TestRegExp_ShortLinkPattern(t *testing.T) { func TestRegExp_AnySHA1Pattern(t *testing.T) { testCases := map[string][]string{ - "https://github.com/jquery/jquery/blob/a644101ed04d0beacea864ce805e0c4f86ba1cd1/test/unit/event.js#L2703": []string{ + "https://github.com/jquery/jquery/blob/a644101ed04d0beacea864ce805e0c4f86ba1cd1/test/unit/event.js#L2703": { "https", "github.com", "jquery", @@ -473,7 +473,7 @@ func TestRegExp_AnySHA1Pattern(t *testing.T) { "test/unit/event.js", "L2703", }, - "https://github.com/jquery/jquery/blob/a644101ed04d0beacea864ce805e0c4f86ba1cd1/test/unit/event.js": []string{ + "https://github.com/jquery/jquery/blob/a644101ed04d0beacea864ce805e0c4f86ba1cd1/test/unit/event.js": { "https", "github.com", "jquery", @@ -483,7 +483,7 @@ func TestRegExp_AnySHA1Pattern(t *testing.T) { "test/unit/event.js", "", }, - "https://github.com/jquery/jquery/commit/0705be475092aede1eddae01319ec931fb9c65fc": []string{ + "https://github.com/jquery/jquery/commit/0705be475092aede1eddae01319ec931fb9c65fc": { "https", "github.com", "jquery", @@ -493,7 +493,7 @@ func TestRegExp_AnySHA1Pattern(t *testing.T) { "", "", }, - "https://github.com/jquery/jquery/tree/0705be475092aede1eddae01319ec931fb9c65fc/src": []string{ + "https://github.com/jquery/jquery/tree/0705be475092aede1eddae01319ec931fb9c65fc/src": { "https", "github.com", "jquery", @@ -503,7 +503,7 @@ func TestRegExp_AnySHA1Pattern(t *testing.T) { "src", "", }, - "https://try.gogs.io/gogs/gogs/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2": []string{ + "https://try.gogs.io/gogs/gogs/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2": { "https", "try.gogs.io", "gogs", @@ -522,35 +522,35 @@ func TestRegExp_AnySHA1Pattern(t *testing.T) { func TestRegExp_IssueFullPattern(t *testing.T) { testCases := map[string][]string{ - "https://github.com/gogits/gogs/pull/3244": []string{ + "https://github.com/gogits/gogs/pull/3244": { "https", "github.com/gogits/gogs/pull/", "3244", "", "", }, - "https://github.com/gogits/gogs/issues/3247#issuecomment-231517079": []string{ + "https://github.com/gogits/gogs/issues/3247#issuecomment-231517079": { "https", "github.com/gogits/gogs/issues/", "3247", "#issuecomment-231517079", "", }, - "https://try.gogs.io/gogs/gogs/issues/4#issue-685": []string{ + "https://try.gogs.io/gogs/gogs/issues/4#issue-685": { "https", "try.gogs.io/gogs/gogs/issues/", "4", "#issue-685", "", }, - "https://youtrack.jetbrains.com/issue/JT-36485": []string{ + "https://youtrack.jetbrains.com/issue/JT-36485": { "https", "youtrack.jetbrains.com/issue/", "JT-36485", "", "", }, - "https://youtrack.jetbrains.com/issue/JT-36485#comment=27-1508676": []string{ + "https://youtrack.jetbrains.com/issue/JT-36485#comment=27-1508676": { "https", "youtrack.jetbrains.com/issue/", "JT-36485",