mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 12:03:57 +01:00
fix: gofmt errors. (#1106)
This commit is contained in:
parent
6bdfadf4a9
commit
28a5bc313a
4 changed files with 20 additions and 18 deletions
|
@ -179,7 +179,7 @@ func AssignForm(form interface{}, data map[string]interface{}) {
|
||||||
func getRuleBody(field reflect.StructField, prefix string) string {
|
func getRuleBody(field reflect.StructField, prefix string) string {
|
||||||
for _, rule := range strings.Split(field.Tag.Get("binding"), ";") {
|
for _, rule := range strings.Split(field.Tag.Get("binding"), ";") {
|
||||||
if strings.HasPrefix(rule, prefix) {
|
if strings.HasPrefix(rule, prefix) {
|
||||||
return rule[len(prefix): len(rule) - 1]
|
return rule[len(prefix) : len(rule)-1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
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 {
|
if errs[0].FieldNames[0] == field.Name {
|
||||||
data["Err_" + field.Name] = true
|
data["Err_"+field.Name] = true
|
||||||
|
|
||||||
trName := field.Tag.Get("locale")
|
trName := field.Tag.Get("locale")
|
||||||
if len(trName) == 0 {
|
if len(trName) == 0 {
|
||||||
|
|
|
@ -37,7 +37,7 @@ type AuthenticationForm struct {
|
||||||
SkipVerify bool
|
SkipVerify bool
|
||||||
PAMServiceName string
|
PAMServiceName string
|
||||||
Oauth2Provider string
|
Oauth2Provider string
|
||||||
Oauth2Key string
|
Oauth2Key string
|
||||||
Oauth2Secret string
|
Oauth2Secret string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,16 +5,18 @@
|
||||||
package oauth2
|
package oauth2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
"github.com/gorilla/sessions"
|
"github.com/gorilla/sessions"
|
||||||
"github.com/markbates/goth"
|
"github.com/markbates/goth"
|
||||||
"github.com/markbates/goth/gothic"
|
"github.com/markbates/goth/gothic"
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"github.com/satori/go.uuid"
|
|
||||||
"path/filepath"
|
|
||||||
"github.com/markbates/goth/providers/github"
|
"github.com/markbates/goth/providers/github"
|
||||||
|
"github.com/satori/go.uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -463,7 +463,7 @@ func TestRegExp_ShortLinkPattern(t *testing.T) {
|
||||||
|
|
||||||
func TestRegExp_AnySHA1Pattern(t *testing.T) {
|
func TestRegExp_AnySHA1Pattern(t *testing.T) {
|
||||||
testCases := map[string][]string{
|
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",
|
"https",
|
||||||
"github.com",
|
"github.com",
|
||||||
"jquery",
|
"jquery",
|
||||||
|
@ -473,7 +473,7 @@ func TestRegExp_AnySHA1Pattern(t *testing.T) {
|
||||||
"test/unit/event.js",
|
"test/unit/event.js",
|
||||||
"L2703",
|
"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",
|
"https",
|
||||||
"github.com",
|
"github.com",
|
||||||
"jquery",
|
"jquery",
|
||||||
|
@ -483,7 +483,7 @@ func TestRegExp_AnySHA1Pattern(t *testing.T) {
|
||||||
"test/unit/event.js",
|
"test/unit/event.js",
|
||||||
"",
|
"",
|
||||||
},
|
},
|
||||||
"https://github.com/jquery/jquery/commit/0705be475092aede1eddae01319ec931fb9c65fc": []string{
|
"https://github.com/jquery/jquery/commit/0705be475092aede1eddae01319ec931fb9c65fc": {
|
||||||
"https",
|
"https",
|
||||||
"github.com",
|
"github.com",
|
||||||
"jquery",
|
"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",
|
"https",
|
||||||
"github.com",
|
"github.com",
|
||||||
"jquery",
|
"jquery",
|
||||||
|
@ -503,7 +503,7 @@ func TestRegExp_AnySHA1Pattern(t *testing.T) {
|
||||||
"src",
|
"src",
|
||||||
"",
|
"",
|
||||||
},
|
},
|
||||||
"https://try.gogs.io/gogs/gogs/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2": []string{
|
"https://try.gogs.io/gogs/gogs/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2": {
|
||||||
"https",
|
"https",
|
||||||
"try.gogs.io",
|
"try.gogs.io",
|
||||||
"gogs",
|
"gogs",
|
||||||
|
@ -522,35 +522,35 @@ func TestRegExp_AnySHA1Pattern(t *testing.T) {
|
||||||
|
|
||||||
func TestRegExp_IssueFullPattern(t *testing.T) {
|
func TestRegExp_IssueFullPattern(t *testing.T) {
|
||||||
testCases := map[string][]string{
|
testCases := map[string][]string{
|
||||||
"https://github.com/gogits/gogs/pull/3244": []string{
|
"https://github.com/gogits/gogs/pull/3244": {
|
||||||
"https",
|
"https",
|
||||||
"github.com/gogits/gogs/pull/",
|
"github.com/gogits/gogs/pull/",
|
||||||
"3244",
|
"3244",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
},
|
},
|
||||||
"https://github.com/gogits/gogs/issues/3247#issuecomment-231517079": []string{
|
"https://github.com/gogits/gogs/issues/3247#issuecomment-231517079": {
|
||||||
"https",
|
"https",
|
||||||
"github.com/gogits/gogs/issues/",
|
"github.com/gogits/gogs/issues/",
|
||||||
"3247",
|
"3247",
|
||||||
"#issuecomment-231517079",
|
"#issuecomment-231517079",
|
||||||
"",
|
"",
|
||||||
},
|
},
|
||||||
"https://try.gogs.io/gogs/gogs/issues/4#issue-685": []string{
|
"https://try.gogs.io/gogs/gogs/issues/4#issue-685": {
|
||||||
"https",
|
"https",
|
||||||
"try.gogs.io/gogs/gogs/issues/",
|
"try.gogs.io/gogs/gogs/issues/",
|
||||||
"4",
|
"4",
|
||||||
"#issue-685",
|
"#issue-685",
|
||||||
"",
|
"",
|
||||||
},
|
},
|
||||||
"https://youtrack.jetbrains.com/issue/JT-36485": []string{
|
"https://youtrack.jetbrains.com/issue/JT-36485": {
|
||||||
"https",
|
"https",
|
||||||
"youtrack.jetbrains.com/issue/",
|
"youtrack.jetbrains.com/issue/",
|
||||||
"JT-36485",
|
"JT-36485",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
},
|
},
|
||||||
"https://youtrack.jetbrains.com/issue/JT-36485#comment=27-1508676": []string{
|
"https://youtrack.jetbrains.com/issue/JT-36485#comment=27-1508676": {
|
||||||
"https",
|
"https",
|
||||||
"youtrack.jetbrains.com/issue/",
|
"youtrack.jetbrains.com/issue/",
|
||||||
"JT-36485",
|
"JT-36485",
|
||||||
|
|
Loading…
Reference in a new issue