multi: fix new linter errors

This commit is contained in:
Oli 2025-11-15 14:56:24 +01:00
parent cfeb370abf
commit f427d66243
No known key found for this signature in database
GPG key ID: 8E4256593F177720
5 changed files with 8 additions and 15 deletions

View file

@ -230,7 +230,7 @@ func (a *ExplorerAPI) PublishTx(rawTxHex string) (string, error) {
return body.String(), nil
}
func fetchJSON(url string, target interface{}) error {
func fetchJSON(url string, target any) error {
resp, err := http.Get(url)
if err != nil {
return fmt.Errorf("error fetching data from API '%s', "+

View file

@ -309,6 +309,7 @@ outer:
importStr := ""
for addr, wif := range resultMap {
//nolint:modernize,perfsprint
importStr += fmt.Sprintf(`importprivkey "%s" "%s" false%s`, wif,
addr, "\n")
}

View file

@ -227,6 +227,7 @@ func printScopeInfo(name string, w *wallet.Wallet,
return "", fmt.Errorf("error fetching account "+
"properties: %w", err)
}
//nolint:modernize,perfsprint
scopeInfo += fmt.Sprintf(
keyScopeformat, scope.Purpose, scope.Coin, name,
props.InternalKeyCount, name, props.ExternalKeyCount,

View file

@ -368,7 +368,7 @@ func fetchChannels(client *graphql.Client, pubkey string) ([]*gqChannel,
offset := 0.0
limit := 50.0
variables := map[string]interface{}{
variables := map[string]any{
"pubkey": pubkey,
"limit": 50.0,
"offset": offset,

View file

@ -4,6 +4,7 @@ import (
"crypto/sha256"
"errors"
"fmt"
"slices"
"strconv"
"strings"
@ -524,25 +525,15 @@ func CheckAndEstimateAddress(addr string, chainParams *chaincfg.Params,
}
func matchAddrType(addr btcutil.Address, allowedTypes ...AddrType) bool {
contains := func(allowedTypes []AddrType, addrType AddrType) bool {
for _, allowedType := range allowedTypes {
if allowedType == addrType {
return true
}
}
return false
}
switch addr.(type) {
case *btcutil.AddressWitnessPubKeyHash:
return contains(allowedTypes, AddrTypeP2WKH)
return slices.Contains(allowedTypes, AddrTypeP2WKH)
case *btcutil.AddressWitnessScriptHash:
return contains(allowedTypes, AddrTypeP2WSH)
return slices.Contains(allowedTypes, AddrTypeP2WSH)
case *btcutil.AddressTaproot:
return contains(allowedTypes, AddrTypeP2TR)
return slices.Contains(allowedTypes, AddrTypeP2TR)
default:
return false