diff options
-rw-r--r-- | internal/db/webhook.go | 4 | ||||
-rw-r--r-- | internal/route/lfs/basic_test.go | 7 | ||||
-rw-r--r-- | internal/route/lfs/batch_test.go | 4 | ||||
-rw-r--r-- | internal/route/lfs/route_test.go | 12 | ||||
-rw-r--r-- | internal/route/repo/setting.go | 4 | ||||
-rw-r--r-- | internal/route/user/setting.go | 4 |
6 files changed, 17 insertions, 18 deletions
diff --git a/internal/db/webhook.go b/internal/db/webhook.go index 3e816061..c26cb5b4 100644 --- a/internal/db/webhook.go +++ b/internal/db/webhook.go @@ -10,7 +10,7 @@ import ( "crypto/tls" "encoding/hex" "fmt" - "io/ioutil" + "io" "net/url" "strings" "time" @@ -775,7 +775,7 @@ func (t *HookTask) deliver() { t.ResponseInfo.Headers[k] = strings.Join(vals, ",") } - p, err := ioutil.ReadAll(resp.Body) + p, err := io.ReadAll(resp.Body) if err != nil { t.ResponseInfo.Body = fmt.Sprintf("read body: %s", err) return diff --git a/internal/route/lfs/basic_test.go b/internal/route/lfs/basic_test.go index db5fb9de..74c837d6 100644 --- a/internal/route/lfs/basic_test.go +++ b/internal/route/lfs/basic_test.go @@ -7,7 +7,6 @@ package lfs import ( "bytes" "io" - "io/ioutil" "net/http" "net/http/httptest" "strings" @@ -133,7 +132,7 @@ func Test_basicHandler_serveDownload(t *testing.T) { assert.Equal(t, test.expStatusCode, resp.StatusCode) assert.Equal(t, test.expHeader, resp.Header) - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -199,7 +198,7 @@ func Test_basicHandler_serveUpload(t *testing.T) { resp := rr.Result() assert.Equal(t, test.expStatusCode, resp.StatusCode) - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -280,7 +279,7 @@ func Test_basicHandler_serveVerify(t *testing.T) { resp := rr.Result() assert.Equal(t, test.expStatusCode, resp.StatusCode) - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } diff --git a/internal/route/lfs/batch_test.go b/internal/route/lfs/batch_test.go index 226e637b..e3feb7ed 100644 --- a/internal/route/lfs/batch_test.go +++ b/internal/route/lfs/batch_test.go @@ -7,7 +7,7 @@ package lfs import ( "bytes" "encoding/json" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -138,7 +138,7 @@ func Test_serveBatch(t *testing.T) { resp := rr.Result() assert.Equal(t, test.expStatusCode, resp.StatusCode) - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } diff --git a/internal/route/lfs/route_test.go b/internal/route/lfs/route_test.go index eb0225d5..a29f8b8c 100644 --- a/internal/route/lfs/route_test.go +++ b/internal/route/lfs/route_test.go @@ -7,7 +7,7 @@ package lfs import ( "context" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -24,7 +24,7 @@ func Test_authenticate(t *testing.T) { m := macaron.New() m.Use(macaron.Renderer()) m.Get("/", authenticate(), func(w http.ResponseWriter, user *db.User) { - fmt.Fprintf(w, "ID: %d, Name: %s", user.ID, user.Name) + _, _ = fmt.Fprintf(w, "ID: %d, Name: %s", user.ID, user.Name) }) tests := []struct { @@ -178,7 +178,7 @@ func Test_authenticate(t *testing.T) { assert.Equal(t, test.expStatusCode, resp.StatusCode) assert.Equal(t, test.expHeader, resp.Header) - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -311,7 +311,7 @@ func Test_authorize(t *testing.T) { resp := rr.Result() assert.Equal(t, test.expStatusCode, resp.StatusCode) - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -402,7 +402,7 @@ func Test_verifyOID(t *testing.T) { resp := rr.Result() assert.Equal(t, test.expStatusCode, resp.StatusCode) - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -418,7 +418,7 @@ func Test_internalServerError(t *testing.T) { resp := rr.Result() assert.Equal(t, http.StatusInternalServerError, resp.StatusCode) - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } diff --git a/internal/route/repo/setting.go b/internal/route/repo/setting.go index a977fcc8..a6df14b6 100644 --- a/internal/route/repo/setting.go +++ b/internal/route/repo/setting.go @@ -6,7 +6,7 @@ package repo import ( "fmt" - "io/ioutil" + "io" "strings" "time" @@ -339,7 +339,7 @@ func UpdateAvatarSetting(c *context.Context, f form.Avatar, ctxRepo *db.Reposito } defer r.Close() - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return fmt.Errorf("read avatar content: %v", err) } diff --git a/internal/route/user/setting.go b/internal/route/user/setting.go index 54771abf..aae38d60 100644 --- a/internal/route/user/setting.go +++ b/internal/route/user/setting.go @@ -10,7 +10,7 @@ import ( "fmt" "html/template" "image/png" - "io/ioutil" + "io" "strings" "github.com/pquerna/otp" @@ -132,7 +132,7 @@ func UpdateAvatarSetting(c *context.Context, f form.Avatar, ctxUser *db.User) er _ = r.Close() }() - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return fmt.Errorf("read avatar content: %v", err) } |