Lint fixes

This commit is contained in:
Alexey Sharp 2021-03-17 20:45:33 +00:00
parent e155b7f985
commit 0275ff5369
6 changed files with 24 additions and 7 deletions

View File

@ -250,6 +250,7 @@ func (a *Address) checksumHex() []byte {
// compute checksum // compute checksum
sha := sha3.NewLegacyKeccak256() sha := sha3.NewLegacyKeccak256()
//nolint:errcheck
sha.Write(buf[2:]) sha.Write(buf[2:])
hash := sha.Sum(nil) hash := sha.Sum(nil)
for i := 2; i < len(buf); i++ { for i := 2; i < len(buf); i++ {

View File

@ -73,7 +73,9 @@ func NewKeccakState() KeccakState {
// HashData hashes the provided data using the KeccakState and returns a 32 byte hash // HashData hashes the provided data using the KeccakState and returns a 32 byte hash
func HashData(kh KeccakState, data []byte) (h common.Hash) { func HashData(kh KeccakState, data []byte) (h common.Hash) {
kh.Reset() kh.Reset()
//nolint:errcheck
kh.Write(data) kh.Write(data)
//nolint:errcheck
kh.Read(h[:]) kh.Read(h[:])
return h return h
} }

View File

@ -46,7 +46,9 @@ func TestSignify(t *testing.T) {
data := make([]byte, 1024) data := make([]byte, 1024)
rand.Read(data) rand.Read(data)
tmpFile.Write(data) if _, err = tmpFile.Write(data); err != nil {
t.Fatal(err)
}
if err = tmpFile.Close(); err != nil { if err = tmpFile.Close(); err != nil {
t.Fatal(err) t.Fatal(err)
@ -90,7 +92,9 @@ func TestSignifyTrustedCommentTooManyLines(t *testing.T) {
data := make([]byte, 1024) data := make([]byte, 1024)
rand.Read(data) rand.Read(data)
tmpFile.Write(data) if _, err = tmpFile.Write(data); err != nil {
t.Fatal(err)
}
if err = tmpFile.Close(); err != nil { if err = tmpFile.Close(); err != nil {
t.Fatal(err) t.Fatal(err)
@ -115,7 +119,9 @@ func TestSignifyTrustedCommentTooManyLinesLF(t *testing.T) {
data := make([]byte, 1024) data := make([]byte, 1024)
rand.Read(data) rand.Read(data)
tmpFile.Write(data) if _, err = tmpFile.Write(data); err != nil {
t.Fatal(err)
}
if err = tmpFile.Close(); err != nil { if err = tmpFile.Close(); err != nil {
t.Fatal(err) t.Fatal(err)
@ -140,7 +146,9 @@ func TestSignifyTrustedCommentEmpty(t *testing.T) {
data := make([]byte, 1024) data := make([]byte, 1024)
rand.Read(data) rand.Read(data)
tmpFile.Write(data) if _, err = tmpFile.Write(data); err != nil {
t.Fatal(err)
}
if err = tmpFile.Close(); err != nil { if err = tmpFile.Close(); err != nil {
t.Fatal(err) t.Fatal(err)

View File

@ -42,7 +42,9 @@ func (e *testEncoder) EncodeRLP(w io.Writer) error {
if e.err != nil { if e.err != nil {
return e.err return e.err
} }
w.Write([]byte{0, 1, 0, 1, 0, 1, 0, 1, 0, 1}) if _, err := w.Write([]byte{0, 1, 0, 1, 0, 1, 0, 1, 0, 1}); err != nil {
return err
}
return nil return nil
} }

View File

@ -105,7 +105,9 @@ func TestHTTPRespBodyUnlimited(t *testing.T) {
s := NewServer() s := NewServer()
defer s.Stop() defer s.Stop()
s.RegisterName("test", largeRespService{respLength}) if err := s.RegisterName("test", largeRespService{respLength}); err != nil {
t.Fatal(err)
}
ts := httptest.NewServer(s) ts := httptest.NewServer(s)
defer ts.Close() defer ts.Close()

View File

@ -168,7 +168,9 @@ func TestClientWebsocketLargeMessage(t *testing.T) {
defer httpsrv.Close() defer httpsrv.Close()
respLength := wsMessageSizeLimit - 50 respLength := wsMessageSizeLimit - 50
srv.RegisterName("test", largeRespService{respLength}) if err := srv.RegisterName("test", largeRespService{respLength}); err != nil {
t.Fatal(err)
}
c, err := DialWebsocket(context.Background(), wsURL, "") c, err := DialWebsocket(context.Background(), wsURL, "")
if err != nil { if err != nil {