From 0c556ef4fa59a0e83945f86ae3d8efad6fad549a Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Fri, 11 Mar 2022 16:47:41 +0100 Subject: [PATCH] tests: fix staticcheck/vet errors --- api/pinsvcapi/pinsvc/pinsvc.go | 1 - util.go | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/api/pinsvcapi/pinsvc/pinsvc.go b/api/pinsvcapi/pinsvc/pinsvc.go index c89b4e90..248a34fb 100644 --- a/api/pinsvcapi/pinsvc/pinsvc.go +++ b/api/pinsvcapi/pinsvc/pinsvc.go @@ -83,7 +83,6 @@ func (p Pin) MatchesName(nameOpt string, strategy MatchingStrategy) bool { default: return true } - return false } // MatchesMeta returns true if the pin status metadata matches the given. The diff --git a/util.go b/util.go index 49c461a5..6cf67472 100644 --- a/util.go +++ b/util.go @@ -12,7 +12,6 @@ import ( cid "github.com/ipfs/go-cid" "github.com/ipfs/ipfs-cluster/api" peer "github.com/libp2p/go-libp2p-core/peer" - "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr" madns "github.com/multiformats/go-multiaddr-dns" ) @@ -187,15 +186,15 @@ func pingValueFromMetric(m *api.Metric) (pv pingValue) { func publicIPFSAddresses(in []api.Multiaddr) []api.Multiaddr { var out []api.Multiaddr - for _, ma := range in { - if madns.Matches(ma.Value()) { // a dns multiaddress: take it - out = append(out, ma) + for _, maddr := range in { + if madns.Matches(maddr.Value()) { // a dns multiaddress: take it + out = append(out, maddr) continue } - ip, err := ma.ValueForProtocol(multiaddr.P_IP4) + ip, err := maddr.ValueForProtocol(ma.P_IP4) if err != nil { - ip, err = ma.ValueForProtocol(multiaddr.P_IP6) + ip, err = maddr.ValueForProtocol(ma.P_IP6) if err != nil { continue } @@ -210,7 +209,7 @@ func publicIPFSAddresses(in []api.Multiaddr) []api.Multiaddr { if !netip.IsGlobalUnicast() { continue } - out = append(out, ma) + out = append(out, maddr) } return out }