multi: use the "errors" package everywhere

Replace all usages of the "github.com/go-errors/errors" and
"github.com/pkg/errors" packages with the standard lib's "errors"
package. This ensures that error wrapping and `errors.Is` checks will
work as expected.
This commit is contained in:
Elle Mouton committed 2025-06-30 09:46:55 +02:00
1 parent 5f961e4349
commit 8cf567b948
44 files changed
+114 -109

No files matched your search

+1 -1
View File
@@ -2,10 +2,10 @@ package htlcswitch
import (
"bytes"
"errors"
"fmt"
"sync"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/htlcswitch/hop"
"github.com/lightningnetwork/lnd/kvdb"
+1 -1
View File
@@ -2,11 +2,11 @@ package htlcswitch
import (
"crypto/sha256"
"errors"
"fmt"
"sync"
"sync/atomic"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/graph/db/models"
+1 -1
View File
@@ -1,6 +1,6 @@
package htlcswitch
import "github.com/go-errors/errors"
import "errors"
var (
// ErrLinkShuttingDown signals that the link is shutting down.
+1 -1
View File
@@ -5,6 +5,7 @@ import (
"context"
"crypto/sha256"
"encoding/binary"
"errors"
"fmt"
"io"
"net"
@@ -18,7 +19,6 @@ import (
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/wire"
"github.com/go-errors/errors"
sphinx "github.com/lightningnetwork/lightning-onion"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
+1 -1
View File
@@ -2,9 +2,9 @@ package htlcswitch
import (
"bytes"
"errors"
"io"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/contractcourt"
"github.com/lightningnetwork/lnd/kvdb"
+1 -1
View File
@@ -1,9 +1,9 @@
package htlcswitch
import (
"errors"
"sync"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/kvdb"
)
+1 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"crypto/rand"
"crypto/sha256"
"errors"
"fmt"
"io"
mrand "math/rand"
@@ -13,7 +14,6 @@ import (
"github.com/btcsuite/btcd/btcutil"
"github.com/davecgh/go-spew/spew"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/contractcourt"
+21 -21
View File
@@ -7,6 +7,7 @@ import (
"crypto/sha256"
"encoding/binary"
"encoding/hex"
"errors"
"fmt"
"net"
"os"
@@ -21,7 +22,6 @@ import (
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/go-errors/errors"
sphinx "github.com/lightningnetwork/lightning-onion"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/contractcourt"
@@ -395,12 +395,12 @@ func createTestChannel(t *testing.T, alicePrivKey, bobPrivKey []byte,
aliceStoredChannels, err = dbAlice.ChannelStateDB().
FetchOpenChannels(aliceKeyPub)
if err != nil {
return nil, errors.Errorf("unable to fetch alice "+
"channel: %v", err)
return nil, fmt.Errorf("unable to fetch alice "+
"channel: %w", err)
}
default:
return nil, errors.Errorf("unable to fetch alice channel: "+
"%v", err)
return nil, fmt.Errorf("unable to fetch alice "+
"channel: %w", err)
}
var aliceStoredChannel *channeldb.OpenChannel
@@ -421,8 +421,8 @@ func createTestChannel(t *testing.T, alicePrivKey, bobPrivKey []byte,
lnwallet.WithAuxSigner(signerMock),
)
if err != nil {
return nil, errors.Errorf("unable to create new channel: %v",
err)
return nil, fmt.Errorf("unable to create new "+
"channel: %w", err)
}
return newAliceChannel, nil
@@ -436,19 +436,19 @@ func createTestChannel(t *testing.T, alicePrivKey, bobPrivKey []byte,
case kvdb.ErrDatabaseNotOpen:
dbBob = channeldb.OpenForTesting(t, dbBob.Path())
if err != nil {
return nil, errors.Errorf("unable to reopen bob "+
"db: %v", err)
return nil, fmt.Errorf("unable to reopen bob "+
"db: %w", err)
}
bobStoredChannels, err = dbBob.ChannelStateDB().
FetchOpenChannels(bobKeyPub)
if err != nil {
return nil, errors.Errorf("unable to fetch bob "+
"channel: %v", err)
return nil, fmt.Errorf("unable to fetch bob "+
"channel: %w", err)
}
default:
return nil, errors.Errorf("unable to fetch bob channel: "+
"%v", err)
return nil, fmt.Errorf("unable to fetch bob channel: "+
"%w", err)
}
var bobStoredChannel *channeldb.OpenChannel
@@ -469,8 +469,8 @@ func createTestChannel(t *testing.T, alicePrivKey, bobPrivKey []byte,
lnwallet.WithAuxSigner(signerMock),
)
if err != nil {
return nil, errors.Errorf("unable to create new channel: %v",
err)
return nil, fmt.Errorf("unable to create new "+
"channel: %w", err)
}
return newBobChannel, nil
}
@@ -881,16 +881,16 @@ func createClusterChannels(t *testing.T, aliceToBob, bobToCarol btcutil.Amount)
bobPrivKey, aliceToBob, aliceToBob, 0, 0, firstChanID,
)
if err != nil {
return nil, nil, errors.Errorf("unable to create "+
"alice<->bob channel: %v", err)
return nil, nil, fmt.Errorf("unable to create "+
"alice<->bob channel: %w", err)
}
secondBobChannel, carolChannel, err := createTestChannel(t, bobPrivKey,
carolPrivKey, bobToCarol, bobToCarol, 0, 0, secondChanID,
)
if err != nil {
return nil, nil, errors.Errorf("unable to create "+
"bob<->carol channel: %v", err)
return nil, nil, fmt.Errorf("unable to create "+
"bob<->carol channel: %w", err)
}
restoreFromDb := func() (*clusterChannels, error) {
@@ -1070,8 +1070,8 @@ func createMirroredChannel(t *testing.T, aliceToBob,
aliceToBob, bobToAlice, 0, 0, firstChanID,
)
if err != nil {
return nil, nil, errors.Errorf("unable to create "+
"alice<->bob channel: %v", err)
return nil, nil, fmt.Errorf("unable to create "+
"alice<->bob channel: %w", err)
}
return alice, bob, nil