1
0
Fork 0
forked from forgejo/forgejo

Add golangci (#6418)

This commit is contained in:
kolaente 2019-06-12 21:41:28 +02:00 committed by techknowlogick
parent 5832f8d90d
commit f9ec2f89f2
147 changed files with 1046 additions and 774 deletions

View file

@ -42,7 +42,7 @@ type NilResponseRecorder struct {
}
func (n *NilResponseRecorder) Write(b []byte) (int, error) {
n.Length = n.Length + len(b)
n.Length += len(b)
return len(b), nil
}
@ -141,8 +141,7 @@ func initIntegrationTest() {
if err != nil {
log.Fatalf("sql.Open: %v", err)
}
rows, err := db.Query(fmt.Sprintf("SELECT 1 FROM pg_database WHERE datname = '%s'",
models.DbCfg.Name))
rows, err := db.Query(fmt.Sprintf("SELECT 1 FROM pg_database WHERE datname = '%s'", models.DbCfg.Name))
if err != nil {
log.Fatalf("db.Query: %v", err)
}
@ -210,7 +209,7 @@ func (s *TestSession) MakeRequest(t testing.TB, req *http.Request, expectedStatu
resp := MakeRequest(t, req, expectedStatus)
ch := http.Header{}
ch.Add("Cookie", strings.Join(resp.HeaderMap["Set-Cookie"], ";"))
ch.Add("Cookie", strings.Join(resp.Header()["Set-Cookie"], ";"))
cr := http.Request{Header: ch}
s.jar.SetCookies(baseURL, cr.Cookies())
@ -226,7 +225,7 @@ func (s *TestSession) MakeRequestNilResponseRecorder(t testing.TB, req *http.Req
resp := MakeRequestNilResponseRecorder(t, req, expectedStatus)
ch := http.Header{}
ch.Add("Cookie", strings.Join(resp.HeaderMap["Set-Cookie"], ";"))
ch.Add("Cookie", strings.Join(resp.Header()["Set-Cookie"], ";"))
cr := http.Request{Header: ch}
s.jar.SetCookies(baseURL, cr.Cookies())
@ -266,7 +265,7 @@ func loginUserWithPassword(t testing.TB, userName, password string) *TestSession
resp = MakeRequest(t, req, http.StatusFound)
ch := http.Header{}
ch.Add("Cookie", strings.Join(resp.HeaderMap["Set-Cookie"], ";"))
ch.Add("Cookie", strings.Join(resp.Header()["Set-Cookie"], ";"))
cr := http.Request{Header: ch}
session := emptyTestSession(t)