Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed all lint errcheck in number of TLDs #2978

Merged
merged 2 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixed PR comments and Close() error causing tests to fail
  • Loading branch information
mhutchinson committed Apr 26, 2023
commit ef7117bb061e3131db4d2566181479519f97b3c8
4 changes: 1 addition & 3 deletions integration/storagetest/logtests.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 130,7 @@ func (*logTests) TestSnapshot(ctx context.Context, t *testing.T, s storage.LogSt
return
}
defer func() {
if err := tx.Close(); err != nil {
t.Errorf("Close(): %v", err)
}
_ = tx.Close()
}()

_, err = tx.LatestSignedLogRoot(ctx)
Expand Down
18 changes: 6 additions & 12 deletions merkle/coniks/coniks.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 54,13 @@ func (m *Hasher) EmptyRoot() []byte {
func (m *Hasher) HashEmpty(treeID int64, root node.ID) []byte {
depth := int(root.BitLen())

// bytes.Buffer never returns errors so we can ignore them below.
buf := bytes.NewBuffer(make([]byte, 0, 32))
h := m.New()
buf.Write(emptyIdentifier)
if err := binary.Write(buf, binary.BigEndian, uint64(treeID)); err != nil {
klog.Errorf("binary.Write(): %v", err)
}
_ = binary.Write(buf, binary.BigEndian, uint64(treeID))
m.writeMaskedNodeID(buf, root)
if err := binary.Write(buf, binary.BigEndian, uint32(depth)); err != nil {
klog.Errorf("binary.Write(): %v", err)
}
_ = binary.Write(buf, binary.BigEndian, uint32(depth))
h.Write(buf.Bytes())
r := h.Sum(nil)
if klog.V(5).Enabled() {
Expand All @@ -76,16 73,13 @@ func (m *Hasher) HashEmpty(treeID int64, root node.ID) []byte {
// H(Identifier || treeID || depth || index || dataHash)
func (m *Hasher) HashLeaf(treeID int64, id node.ID, leaf []byte) []byte {
depth := int(id.BitLen())
// bytes.Buffer never returns errors so we can ignore them below.
buf := bytes.NewBuffer(make([]byte, 0, 32 len(leaf)))
h := m.New()
buf.Write(leafIdentifier)
if err := binary.Write(buf, binary.BigEndian, uint64(treeID)); err != nil {
klog.Errorf("binary.Write(): %v", err)
}
_ = binary.Write(buf, binary.BigEndian, uint64(treeID))
m.writeMaskedNodeID(buf, id)
if err := binary.Write(buf, binary.BigEndian, uint32(depth)); err != nil {
klog.Errorf("binary.Write(): %v", err)
}
_ = binary.Write(buf, binary.BigEndian, uint32(depth))
buf.Write(leaf)
h.Write(buf.Bytes())
p := h.Sum(nil)
Expand Down
2 changes: 1 addition & 1 deletion testonly/mdm/mdm.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 133,7 @@ func (m *MergeDelayMonitor) monitor(ctx context.Context, idx int) error {
}
if createNew {
if _, err := crand.Read(data); err != nil {
return fmt.Errorf("rand.Read(): %v", err)
return fmt.Errorf("Read(): %v", err)
}
}

Expand Down