multi: Removed deprecated interfacer linter

Removed the deprecated interfacer linter from being called for linting.

Also removed the `nolint:interfacer` within the code.

https://github.com/lightningnetwork/lnd/issues/5741
This commit is contained in:
naveen 2021-12-13 15:32:23 +01:00 committed by Oliver Gugger
parent 545e84f4ce
commit 87a0e52464
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
7 changed files with 21 additions and 47 deletions

View File

@ -58,6 +58,9 @@ linters:
# Init functions are used by loggers throughout the codebase.
- gochecknoinits
# interfacer has been archived.
- interfacer
issues:
# Only show newly introduced problems.
new-from-rev: 01f696afce2f9c0d4ed854edefa3846891d01d8a

View File

@ -882,8 +882,9 @@ func fetchChanBucket(tx kvdb.RTx, nodeKey *btcec.PublicKey,
// channel's data resides in given: the public key for the node, the outpoint,
// and the chainhash that the channel resides on. This differs from
// fetchChanBucket in that it returns a writeable bucket.
func fetchChanBucketRw(tx kvdb.RwTx, nodeKey *btcec.PublicKey, // nolint:interfacer
outPoint *wire.OutPoint, chainHash chainhash.Hash) (kvdb.RwBucket, error) {
func fetchChanBucketRw(tx kvdb.RwTx, nodeKey *btcec.PublicKey,
outPoint *wire.OutPoint, chainHash chainhash.Hash) (kvdb.RwBucket,
error) {
// First fetch the top level bucket which stores all data related to
// current, active channels.

View File

@ -578,7 +578,9 @@ func (c *ChannelGraph) DisabledChannelIDs() ([]uint64, error) {
//
// TODO(roasbeef): add iterator interface to allow for memory efficient graph
// traversal when graph gets mega
func (c *ChannelGraph) ForEachNode(cb func(kvdb.RTx, *LightningNode) error) error { // nolint:interfacer
func (c *ChannelGraph) ForEachNode(
cb func(kvdb.RTx, *LightningNode) error) error {
traversal := func(tx kvdb.RTx) error {
// First grab the nodes bucket which stores the mapping from
// pubKey to node information.

View File

@ -731,7 +731,9 @@ func fetchPaymentWithSequenceNumber(tx kvdb.RTx, paymentHash lntypes.Hash,
// DeletePayment deletes a payment from the DB given its payment hash. If
// failedHtlcsOnly is set, only failed HTLC attempts of the payment will be
// deleted.
func (d *DB) DeletePayment(paymentHash lntypes.Hash, failedHtlcsOnly bool) error { // nolint:interfacer
func (d *DB) DeletePayment(paymentHash lntypes.Hash,
failedHtlcsOnly bool) error {
return kvdb.Update(d, func(tx kvdb.RwTx) error {
payments := tx.ReadWriteBucket(paymentsRootBucket)
if payments == nil {

View File

@ -1351,7 +1351,6 @@ func (n *NetworkHarness) WaitForChannelClose(
// an optional set of check functions which can be used to make further
// assertions using channel's values. These functions are responsible for
// failing the test themselves if they do not pass.
// nolint: interfacer
func (n *NetworkHarness) AssertChannelExists(node *HarnessNode,
chanPoint *wire.OutPoint, checks ...func(*lnrpc.Channel)) error {

View File

@ -589,9 +589,8 @@ func shutdownAndAssert(net *lntest.NetworkHarness, t *harnessTest,
// assertChannelBalanceResp makes a ChannelBalance request and checks the
// returned response matches the expected.
func assertChannelBalanceResp(t *harnessTest,
node *lntest.HarnessNode,
expected *lnrpc.ChannelBalanceResponse) { // nolint:interfacer
func assertChannelBalanceResp(t *harnessTest, node *lntest.HarnessNode,
expected *lnrpc.ChannelBalanceResponse) {
resp := getChannelBalance(t, node)
require.True(t.t, proto.Equal(expected, resp), "balance is incorrect")

View File

@ -50,32 +50,20 @@ func ErrOutpointIndexTooBig(index uint32) error {
}
// WriteBytes appends the given bytes to the provided buffer.
//
// Note: We intentionally skip the interfacer linter check here because we want
// to have concrete type (bytes.Buffer) rather than interface type (io.Write)
// due to performance concern.
func WriteBytes(buf *bytes.Buffer, b []byte) error { // nolint: interfacer
func WriteBytes(buf *bytes.Buffer, b []byte) error {
_, err := buf.Write(b)
return err
}
// WriteUint8 appends the uint8 to the provided buffer.
//
// Note: We intentionally skip the interfacer linter check here because we want
// to have concrete type (bytes.Buffer) rather than interface type (io.Write)
// due to performance concern.
func WriteUint8(buf *bytes.Buffer, n uint8) error { // nolint: interfacer
func WriteUint8(buf *bytes.Buffer, n uint8) error {
_, err := buf.Write([]byte{n})
return err
}
// WriteUint16 appends the uint16 to the provided buffer. It encodes the
// integer using big endian byte order.
//
// Note: We intentionally skip the interfacer linter check here because we want
// to have concrete type (bytes.Buffer) rather than interface type (io.Write)
// due to performance concern.
func WriteUint16(buf *bytes.Buffer, n uint16) error { // nolint: interfacer
func WriteUint16(buf *bytes.Buffer, n uint16) error {
var b [2]byte
binary.BigEndian.PutUint16(b[:], n)
_, err := buf.Write(b[:])
@ -93,11 +81,7 @@ func WriteUint32(buf *bytes.Buffer, n uint32) error {
// WriteUint64 appends the uint64 to the provided buffer. It encodes the
// integer using big endian byte order.
//
// Note: We intentionally skip the interfacer linter check here because we want
// to have concrete type (bytes.Buffer) rather than interface type (io.Write)
// due to performance concern.
func WriteUint64(buf *bytes.Buffer, n uint64) error { // nolint: interfacer
func WriteUint64(buf *bytes.Buffer, n uint64) error {
var b [8]byte
binary.BigEndian.PutUint64(b[:], n)
_, err := buf.Write(b[:])
@ -194,13 +178,7 @@ func WriteFailCode(buf *bytes.Buffer, e FailCode) error {
// WriteRawFeatureVector encodes the feature using the feature's Encode method
// and appends the data to the provided buffer. An error will return if the
// passed feature is nil.
//
// Note: We intentionally skip the interfacer linter check here because we want
// to have concrete type (bytes.Buffer) rather than interface type (io.Write)
// due to performance concern.
func WriteRawFeatureVector(buf *bytes.Buffer, // nolint: interfacer
feature *RawFeatureVector) error {
func WriteRawFeatureVector(buf *bytes.Buffer, feature *RawFeatureVector) error {
if feature == nil {
return ErrNilFeatureVector
}
@ -280,11 +258,7 @@ func WriteBool(buf *bytes.Buffer, b bool) error {
// WritePkScript appends the script to the provided buffer. Returns an error if
// the provided script exceeds 34 bytes.
//
// Note: We intentionally skip the interfacer linter check here because we want
// to have concrete type (bytes.Buffer) rather than interface type (io.Write)
// due to performance concern.
func WritePkScript(buf *bytes.Buffer, s PkScript) error { // nolint: interfacer
func WritePkScript(buf *bytes.Buffer, s PkScript) error {
// The largest script we'll accept is a p2wsh which is exactly
// 34 bytes long.
scriptLength := len(s)
@ -412,13 +386,7 @@ func WriteNetAddrs(buf *bytes.Buffer, addresses []net.Addr) error {
}
// writeDataWithLength writes the data and its length to the buffer.
//
// Note: We intentionally skip the interfacer linter check here because we want
// to have concrete type (bytes.Buffer) rather than interface type (io.Write)
// due to performance concern.
func writeDataWithLength(buf *bytes.Buffer, // nolint: interfacer
data []byte) error {
func writeDataWithLength(buf *bytes.Buffer, data []byte) error {
var l [2]byte
binary.BigEndian.PutUint16(l[:], uint16(len(data)))
if _, err := buf.Write(l[:]); err != nil {