mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-09 16:55:16 +00:00
lint fix
This commit is contained in:
parent
ca5eaa8c6b
commit
9a9ac33766
|
@ -178,7 +178,8 @@ func Test_PersonUnmarshalJSON(t *testing.T) {
|
|||
PreferredUsername: ap.NaturalLanguageValues{
|
||||
ap.LangRefValue{Ref: "en", Value: []byte("MaxMuster")},
|
||||
},
|
||||
}}
|
||||
},
|
||||
}
|
||||
sut := new(ForgePerson)
|
||||
err := sut.UnmarshalJSON([]byte(`{"type":"Person","preferredUsername":"MaxMuster"}`))
|
||||
if err != nil {
|
||||
|
|
|
@ -62,19 +62,19 @@ func (node NodeInfoWellKnown) Validate() []string {
|
|||
var result []string
|
||||
result = append(result, validation.ValidateNotEmpty(node.Href, "Href")...)
|
||||
|
||||
parsedUrl, err := url.Parse(node.Href)
|
||||
parsedURL, err := url.Parse(node.Href)
|
||||
if err != nil {
|
||||
result = append(result, err.Error())
|
||||
return result
|
||||
}
|
||||
|
||||
if parsedUrl.Host == "" {
|
||||
if parsedURL.Host == "" {
|
||||
result = append(result, "Href has to be absolute")
|
||||
}
|
||||
|
||||
result = append(result, validation.ValidateOneOf(parsedUrl.Scheme, []any{"http", "https"})...)
|
||||
result = append(result, validation.ValidateOneOf(parsedURL.Scheme, []any{"http", "https"})...)
|
||||
|
||||
if parsedUrl.RawQuery != "" {
|
||||
if parsedURL.RawQuery != "" {
|
||||
result = append(result, "Href may not contain query")
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ func Test_ValidateNotEmpty_ForTimestamp(t *testing.T) {
|
|||
if res := ValidateNotEmpty(sut, "dummyField"); len(res) > 0 {
|
||||
t.Errorf("sut should be valid but was %q", res)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func Test_ValidateMaxLen(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue