Skip to content

Commit fad54a9

Browse files
committed
Fix linting
1 parent f91b160 commit fad54a9

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

.golangci.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,16 @@
4747
"gochecknoglobals",
4848
"gocritic",
4949
"godot",
50+
"godox",
5051
"testifylint",
5152
"revive",
5253
"gochecknoinits",
5354
"forbidigo",
5455
"err113",
5556
"errorlint",
56-
"gosec"
57+
"gosec",
58+
"unused",
59+
"gomoddirectives"
5760
],
5861
"enable": [
5962
"asasalint",

inpoints.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ func NewTxInpoints() TxInpoints {
3434

3535
func NewTxInpointsFromTx(tx *bt.Tx) (TxInpoints, error) {
3636
p := NewTxInpoints()
37-
if err := p.addTx(tx); err != nil {
38-
return p, err
39-
}
37+
p.addTx(tx)
4038

4139
return p, nil
4240
}
@@ -47,9 +45,7 @@ func NewTxInpointsFromInputs(inputs []*bt.Input) (TxInpoints, error) {
4745
tx := &bt.Tx{}
4846
tx.Inputs = inputs
4947

50-
if err := p.addTx(tx); err != nil {
51-
return p, err
52-
}
48+
p.addTx(tx)
5349

5450
return p, nil
5551
}
@@ -78,7 +74,7 @@ func (p *TxInpoints) String() string {
7874
return fmt.Sprintf("TxInpoints{ParentTxHashes: %v, Idxs: %v}", p.ParentTxHashes, p.Idxs)
7975
}
8076

81-
func (p *TxInpoints) addTx(tx *bt.Tx) error {
77+
func (p *TxInpoints) addTx(tx *bt.Tx) {
8278
// Do not error out for transactions without inputs, seeded Teranodes will have txs without inputs
8379

8480
for _, input := range tx.Inputs {
@@ -94,8 +90,6 @@ func (p *TxInpoints) addTx(tx *bt.Tx) error {
9490

9591
p.nrInpoints++
9692
}
97-
98-
return nil
9993
}
10094

10195
// GetParentTxHashes returns the unique parent tx hashes

subtree_meta_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ func TestSubtreeMetaGetTxInpoints(t *testing.T) {
237237

238238
t.Run("empty subtree", func(t *testing.T) {
239239
subtree, _ := NewTreeByLeafCount(4)
240-
subtreeMeta := NewSubtreeMeta(subtree)
240+
emptySubtreeMeta := NewSubtreeMeta(subtree)
241241

242-
inpoints, err := subtreeMeta.GetTxInpoints(0)
242+
inpoints, err := emptySubtreeMeta.GetTxInpoints(0)
243243
require.NoError(t, err)
244244

245245
assert.Equal(t, 0, len(inpoints))

subtree_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func TestGetMap(t *testing.T) {
164164

165165
// find node in original tree
166166
originalIdx := st.NodeIndex(node.Hash)
167-
assert.Equal(t, uint64(originalIdx), txIdx) // nolint:gosec
167+
assert.Equal(t, uint64(originalIdx), txIdx) //nolint:gosec // Ignore for now
168168
}
169169
}
170170

0 commit comments

Comments
 (0)