multi: fix linter issues

pull/17/head
Oliver Gugger 3 years ago
parent e990c6271d
commit 1e7f676803
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

@ -2,10 +2,6 @@ run:
# timeout for analysis
deadline: 4m
# Linting uses a lot of memory. Keep it under control by only running a single
# worker.
concurrency: 1
linters-settings:
govet:
# Don't report about shadowed variables

@ -66,7 +66,7 @@ func EntropyFromMnemonic(mnemonic string) ([]byte, error) {
b := big.NewInt(0)
for _, v := range mnemonicSlice {
index, found := wordMap[v]
if found == false {
if !found {
return nil, fmt.Errorf("word `%v` not found in "+
"reverse map", v)
}
@ -106,7 +106,7 @@ func EntropyFromMnemonic(mnemonic string) ([]byte, error) {
func computeChecksum(data []byte) []byte {
hasher := sha256.New()
hasher.Write(data)
_, _ = hasher.Write(data)
return hasher.Sum(nil)
}

@ -8,7 +8,7 @@ import (
"strings"
)
func init() {
func init() { //nolint:gochecknoinits
// Ensure word list is correct
// $ wget https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/english.txt
// $ crc32 english.txt

@ -2,12 +2,12 @@ package btc
import (
"fmt"
"github.com/btcsuite/btcd/wire"
"io"
"time"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcutil/hdkeychain"
"github.com/guggero/chantools/lnd"

@ -16,8 +16,7 @@ import (
)
const (
HardenedKeyStart = 0x80000000 // 2^31
serializedKeyLen = 4 + 1 + 4 + 4 + 32 + 33 // 78 bytes
HardenedKeyStart = 0x80000000 // 2^31
keyLen = 33
)
@ -50,7 +49,7 @@ func (k *FastDerivation) Child(i uint32) error {
binary.BigEndian.PutUint32(k.scratch[keyLen:], i)
hmac512 := hmac.New(sha512.New, k.chainCode)
hmac512.Write(k.scratch[:])
_, _ = hmac512.Write(k.scratch[:])
ilr := hmac512.Sum(nil)
il := ilr[:len(ilr)/2]
@ -84,7 +83,7 @@ func NewFastDerivation(seed []byte, net *chaincfg.Params) (*FastDerivation, erro
// First take the HMAC-SHA512 of the master key and the seed data:
// I = HMAC-SHA512(Key = "Bitcoin seed", Data = S)
hmac512 := hmac.New(sha512.New, masterKey)
hmac512.Write(seed)
_, _ = hmac512.Write(seed)
lr := hmac512.Sum(nil)
// Split "I" into two 32-byte sequences Il and Ir where:

@ -2,10 +2,10 @@ package main
import (
"fmt"
"github.com/btcsuite/btcutil"
"github.com/guggero/chantools/btc"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcutil/hdkeychain"
"github.com/guggero/chantools/btc"
"github.com/guggero/chantools/lnd"
)

@ -3,12 +3,12 @@ package main
import (
"bytes"
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcutil/psbt"
"github.com/lightningnetwork/lnd/keychain"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcutil/hdkeychain"
"github.com/btcsuite/btcutil/psbt"
"github.com/guggero/chantools/lnd"
"github.com/lightningnetwork/lnd/keychain"
)
type signRescueFundingCommand struct {

@ -4,9 +4,8 @@ import (
"bytes"
"encoding/hex"
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
@ -15,6 +14,7 @@ import (
"github.com/guggero/chantools/dataformat"
"github.com/guggero/chantools/lnd"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
)
const (

@ -21,7 +21,7 @@ const (
)
var (
numberDotsRegex = regexp.MustCompile("[\\d.\\-\\n\\r\\t]*")
numberDotsRegex = regexp.MustCompile(`[\d.\-\n\r\t]*`)
multipleSpaces = regexp.MustCompile(" [ ]+")
)

@ -2,17 +2,17 @@ package lnd
import (
"fmt"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/lightningnetwork/lnd/shachain"
"strconv"
"strings"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcutil/hdkeychain"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/shachain"
)
const (

@ -2,6 +2,7 @@ package lnd
import (
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/txscript"

Loading…
Cancel
Save