fix golint issues

This commit is contained in:
kevin
2020-10-16 10:50:43 +08:00
parent 338caf9927
commit 94645481b1
27 changed files with 73 additions and 88 deletions

View File

@@ -6,6 +6,8 @@ import (
"io"
)
const unzipLimit = 100 * 1024 * 1024 // 100MB
func Gzip(bs []byte) []byte {
var b bytes.Buffer
@@ -24,8 +26,7 @@ func Gunzip(bs []byte) ([]byte, error) {
defer r.Close()
var c bytes.Buffer
_, err = io.Copy(&c, r)
if err != nil {
if _, err = io.Copy(&c, io.LimitReader(r, unzipLimit)); err != nil {
return nil, err
}

View File

@@ -30,8 +30,7 @@ FstHGSkUYFLe+nl1dEKHbD+/Zt95L757J3xGTrwoTc7KCTxbrgn+stn0w52BNjj/
kIE2ko4lbh/v8Fl14AyVR9msfKtKOnhe5FCT72mdtApr+qvzcC3q9hfXwkyQU32p
v7q5UimZ205iKSBmgQIDAQAB
-----END PUBLIC KEY-----`
testBody = `this is the content`
encryptedBody = `49e7bc15640e5d927fd3f129b749536d0755baf03a0f35fc914ff1b7b8ce659e5fe3a598442eb908c5995e28bacd3d76e4420bb05b6bfc177040f66c6976f680f7123505d626ab96a9db1151f45c93bc0262db9087b9fb6801715f76f902e644a20029262858f05b0d10540842204346ac1d6d8f29cc5d47dab79af75d922ef2`
testBody = `this is the content`
)
func TestCryption(t *testing.T) {