Skip to content

Commit 595a82c

Browse files
add linting
1 parent 7b7da5a commit 595a82c

File tree

7 files changed

+16
-11
lines changed

7 files changed

+16
-11
lines changed

.golangci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ linters-settings:
3838
json: goCamel
3939
yaml: goCamel
4040

41-
4241
gocritic:
4342
# Which checks should be enabled; can't be combined with 'disabled-checks';
4443
# See https://go-critic.github.io/overview#checks-overview
@@ -112,6 +111,8 @@ linters-settings:
112111
disabled: false
113112
- name: unnecessary-stmt
114113
disabled: false
114+
- name: unused-parameter
115+
disabled: false
115116
- name: unreachable-code
116117
disabled: false
117118
- name: package-comments

rhp/v4/quic/quic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type (
5454
// WithTLSConfig is a QUICTransportOption that sets the TLSConfig
5555
// for the QUIC connection.
5656
func WithTLSConfig(fn func(*tls.Config)) ClientOption {
57-
return func(qc *quic.Config, tc *tls.Config) {
57+
return func(_ *quic.Config, tc *tls.Config) {
5858
fn(tc)
5959
}
6060
}

rhp/v4/rpc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func startTestNode(tb testing.TB, n *consensus.Network, genesis types.Block) (*c
140140
}
141141
}()
142142

143-
stop := cm.OnReorg(func(index types.ChainIndex) {
143+
stop := cm.OnReorg(func(_ types.ChainIndex) {
144144
select {
145145
case reorgCh <- struct{}{}:
146146
default:

rhp/v4/siamux/siamux.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,16 @@ func Dial(ctx context.Context, addr string, peerKey types.PublicKey) (rhp4.Trans
6666
if err != nil {
6767
return nil, fmt.Errorf("failed to connect to %q: %w", addr, err)
6868
}
69-
70-
return Upgrade(ctx, conn, peerKey)
69+
if deadline, ok := ctx.Deadline(); ok {
70+
if err := conn.SetDeadline(deadline); err != nil {
71+
return nil, fmt.Errorf("failed to set deadline: %w", err)
72+
}
73+
}
74+
return Upgrade(conn, peerKey)
7175
}
7276

7377
// Upgrade upgrades an existing connection to use the SiaMux transport.
74-
func Upgrade(ctx context.Context, conn net.Conn, peerKey types.PublicKey) (rhp4.TransportClient, error) {
78+
func Upgrade(conn net.Conn, peerKey types.PublicKey) (rhp4.TransportClient, error) {
7579
m, err := mux.Dial(conn, peerKey[:])
7680
if err != nil {
7781
return nil, fmt.Errorf("failed to establish siamux connection: %w", err)

testutil/host.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (es *EphemeralSectorStore) ReadSector(root types.Hash256) (*[proto4.SectorS
7676
}
7777

7878
// StoreSector stores a sector in the EphemeralSectorStore.
79-
func (es *EphemeralSectorStore) StoreSector(root types.Hash256, sector *[proto4.SectorSize]byte, expiration uint64) error {
79+
func (es *EphemeralSectorStore) StoreSector(root types.Hash256, sector *[proto4.SectorSize]byte, _ uint64) error {
8080
es.mu.Lock()
8181
defer es.mu.Unlock()
8282
es.sectors[root] = sector

testutil/syncer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ func (ps *EphemeralPeerStore) UpdatePeerInfo(addr string, fn func(*syncer.PeerIn
6161

6262
// Ban temporarily bans one or more IPs. The addr should either be a single
6363
// IP with port (e.g. 1.2.3.4:5678) or a CIDR subnet (e.g. 1.2.3.4/16).
64-
func (ps *EphemeralPeerStore) Ban(addr string, duration time.Duration, reason string) error {
64+
func (ps *EphemeralPeerStore) Ban(_ string, _ time.Duration, _ string) error {
6565
return nil
6666
}
6767

6868
// Banned returns false
69-
func (ps *EphemeralPeerStore) Banned(addr string) (bool, error) { return false, nil }
69+
func (ps *EphemeralPeerStore) Banned(_ string) (bool, error) { return false, nil }
7070

7171
var _ syncer.PeerStore = (*EphemeralPeerStore)(nil)
7272

testutil/wallet.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (et *ephemeralWalletUpdateTxn) UpdateWalletSiacoinElementProofs(pu wallet.P
4444
return nil
4545
}
4646

47-
func (et *ephemeralWalletUpdateTxn) WalletApplyIndex(index types.ChainIndex, created, spent []types.SiacoinElement, events []wallet.Event, timestamp time.Time) error {
47+
func (et *ephemeralWalletUpdateTxn) WalletApplyIndex(index types.ChainIndex, created, spent []types.SiacoinElement, events []wallet.Event, _ time.Time) error {
4848
for _, se := range spent {
4949
if _, ok := et.store.utxos[types.SiacoinOutputID(se.ID)]; !ok {
5050
panic(fmt.Sprintf("siacoin element %q does not exist", se.ID))
@@ -65,7 +65,7 @@ func (et *ephemeralWalletUpdateTxn) WalletApplyIndex(index types.ChainIndex, cre
6565
return nil
6666
}
6767

68-
func (et *ephemeralWalletUpdateTxn) WalletRevertIndex(index types.ChainIndex, removed, unspent []types.SiacoinElement, timestamp time.Time) error {
68+
func (et *ephemeralWalletUpdateTxn) WalletRevertIndex(index types.ChainIndex, removed, unspent []types.SiacoinElement, _ time.Time) error {
6969
// remove any events that were added in the reverted block
7070
filtered := et.store.events[:0]
7171
for i := range et.store.events {

0 commit comments

Comments
 (0)