mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-25 11:16:11 +01: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{
|
PreferredUsername: ap.NaturalLanguageValues{
|
||||||
ap.LangRefValue{Ref: "en", Value: []byte("MaxMuster")},
|
ap.LangRefValue{Ref: "en", Value: []byte("MaxMuster")},
|
||||||
},
|
},
|
||||||
}}
|
},
|
||||||
|
}
|
||||||
sut := new(ForgePerson)
|
sut := new(ForgePerson)
|
||||||
err := sut.UnmarshalJSON([]byte(`{"type":"Person","preferredUsername":"MaxMuster"}`))
|
err := sut.UnmarshalJSON([]byte(`{"type":"Person","preferredUsername":"MaxMuster"}`))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -62,19 +62,19 @@ func (node NodeInfoWellKnown) Validate() []string {
|
||||||
var result []string
|
var result []string
|
||||||
result = append(result, validation.ValidateNotEmpty(node.Href, "Href")...)
|
result = append(result, validation.ValidateNotEmpty(node.Href, "Href")...)
|
||||||
|
|
||||||
parsedUrl, err := url.Parse(node.Href)
|
parsedURL, err := url.Parse(node.Href)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result = append(result, err.Error())
|
result = append(result, err.Error())
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
if parsedUrl.Host == "" {
|
if parsedURL.Host == "" {
|
||||||
result = append(result, "Href has to be absolute")
|
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")
|
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 {
|
if res := ValidateNotEmpty(sut, "dummyField"); len(res) > 0 {
|
||||||
t.Errorf("sut should be valid but was %q", res)
|
t.Errorf("sut should be valid but was %q", res)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_ValidateMaxLen(t *testing.T) {
|
func Test_ValidateMaxLen(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue