fix: gofmt errors. (#1106)

This commit is contained in:
Bo-Yi Wu 2017-03-03 16:21:31 +08:00 committed by Lunny Xiao
parent 6bdfadf4a9
commit 28a5bc313a
4 changed files with 20 additions and 18 deletions

View file

@ -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 {

View file

@ -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 (

View file

@ -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",