From 21baa7bf18c0e4e0d52f99015df801afcb610022 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Wed, 24 Jul 2019 10:58:13 +0200 Subject: [PATCH] multi: fix linter errors --- channeldb/channel.go | 3 ++- htlcswitch/switch.go | 6 +----- macaroons/constraints_test.go | 4 ++-- watchtower/wtdb/client_db.go | 2 +- watchtower/wtdb/codec.go | 4 ++-- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/channeldb/channel.go b/channeldb/channel.go index 341a8698..4a9f21ef 100644 --- a/channeldb/channel.go +++ b/channeldb/channel.go @@ -1790,7 +1790,8 @@ func (c *OpenChannel) RemoveFwdPkg(height uint64) error { // RevocationLogTail returns the "tail", or the end of the current revocation // log. This entry represents the last previous state for the remote node's -// commitment chain. The ChannelDelta returned by this method will always lag one state behind the most current (unrevoked) state of the remote node's +// commitment chain. The ChannelDelta returned by this method will always lag +// one state behind the most current (unrevoked) state of the remote node's // commitment chain. func (c *OpenChannel) RevocationLogTail() (*ChannelCommitment, error) { c.RLock() diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index 22b935bb..82cdc979 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -1194,11 +1194,7 @@ func (s *Switch) handlePacketForward(packet *htlcPacket) error { fail.Reason = circuit.ErrorEncrypter.EncryptMalformedError( fail.Reason, ) - if err != nil { - err = fmt.Errorf("unable to obfuscate "+ - "error: %v", err) - log.Error(err) - } + default: // Otherwise, it's a forwarded error, so we'll perform a // wrapper encryption as normal. diff --git a/macaroons/constraints_test.go b/macaroons/constraints_test.go index 0d15aff1..dd97536a 100644 --- a/macaroons/constraints_test.go +++ b/macaroons/constraints_test.go @@ -11,14 +11,14 @@ import ( var ( testRootKey = []byte("dummyRootKey") - testId = []byte("dummyId") + testID = []byte("dummyId") testLocation = "lnd" testVersion = macaroon.LatestVersion expectedTimeCaveatSubstring = "time-before " + string(time.Now().Year()) ) func createDummyMacaroon(t *testing.T) *macaroon.Macaroon { - dummyMacaroon, err := macaroon.New(testRootKey, testId, + dummyMacaroon, err := macaroon.New(testRootKey, testID, testLocation, testVersion) if err != nil { t.Fatalf("Error creating initial macaroon: %v", err) diff --git a/watchtower/wtdb/client_db.go b/watchtower/wtdb/client_db.go index 6794f8b3..169b9042 100644 --- a/watchtower/wtdb/client_db.go +++ b/watchtower/wtdb/client_db.go @@ -665,7 +665,7 @@ func (c *ClientDB) RegisterChannel(chanID lnwire.ChannelID, case err == ErrChannelNotRegistered: // Unexpected error. - case err != nil: + default: return err } diff --git a/watchtower/wtdb/codec.go b/watchtower/wtdb/codec.go index 8c88f814..4cfa6b6b 100644 --- a/watchtower/wtdb/codec.go +++ b/watchtower/wtdb/codec.go @@ -22,7 +22,7 @@ func ReadElement(r io.Reader, element interface{}) error { return nil // Fail if error is not UnknownElementType. - case err != nil: + default: if _, ok := err.(UnknownElementType); !ok { return err } @@ -80,7 +80,7 @@ func WriteElement(w io.Writer, element interface{}) error { return nil // Fail if error is not UnknownElementType. - case err != nil: + default: if _, ok := err.(UnknownElementType); !ok { return err }