Address lint issues as a result of libp2p deprecations and tidy go mod

Address staticcheck issues caused by deprecated APIs and `go mod tidy`.
This commit is contained in:
Masih H. Derkani 2022-06-29 15:53:15 +01:00 committed by Aayush
parent 57ed804304
commit 39a710e1d6
4 changed files with 6 additions and 6 deletions

4
go.mod
View File

@ -113,7 +113,6 @@ require (
github.com/libp2p/go-libp2p v0.20.1 github.com/libp2p/go-libp2p v0.20.1
github.com/libp2p/go-libp2p-connmgr v0.3.1 github.com/libp2p/go-libp2p-connmgr v0.3.1
github.com/libp2p/go-libp2p-core v0.16.1 github.com/libp2p/go-libp2p-core v0.16.1
github.com/libp2p/go-libp2p-discovery v0.7.0
github.com/libp2p/go-libp2p-kad-dht v0.15.0 github.com/libp2p/go-libp2p-kad-dht v0.15.0
github.com/libp2p/go-libp2p-noise v0.4.0 github.com/libp2p/go-libp2p-noise v0.4.0
github.com/libp2p/go-libp2p-peerstore v0.7.0 github.com/libp2p/go-libp2p-peerstore v0.7.0
@ -122,7 +121,6 @@ require (
github.com/libp2p/go-libp2p-record v0.1.3 github.com/libp2p/go-libp2p-record v0.1.3
github.com/libp2p/go-libp2p-resource-manager v0.3.0 github.com/libp2p/go-libp2p-resource-manager v0.3.0
github.com/libp2p/go-libp2p-routing-helpers v0.2.3 github.com/libp2p/go-libp2p-routing-helpers v0.2.3
github.com/libp2p/go-libp2p-swarm v0.11.0
github.com/libp2p/go-libp2p-tls v0.4.1 github.com/libp2p/go-libp2p-tls v0.4.1
github.com/libp2p/go-libp2p-yamux v0.9.1 github.com/libp2p/go-libp2p-yamux v0.9.1
github.com/libp2p/go-maddr-filter v0.1.0 github.com/libp2p/go-maddr-filter v0.1.0
@ -261,9 +259,11 @@ require (
github.com/libp2p/go-cidranger v1.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect
github.com/libp2p/go-flow-metrics v0.0.3 // indirect github.com/libp2p/go-flow-metrics v0.0.3 // indirect
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
github.com/libp2p/go-libp2p-discovery v0.7.0 // indirect
github.com/libp2p/go-libp2p-gostream v0.3.1 // indirect github.com/libp2p/go-libp2p-gostream v0.3.1 // indirect
github.com/libp2p/go-libp2p-kbucket v0.4.7 // indirect github.com/libp2p/go-libp2p-kbucket v0.4.7 // indirect
github.com/libp2p/go-libp2p-loggables v0.1.0 // indirect github.com/libp2p/go-libp2p-loggables v0.1.0 // indirect
github.com/libp2p/go-libp2p-swarm v0.11.0 // indirect
github.com/libp2p/go-msgio v0.2.0 // indirect github.com/libp2p/go-msgio v0.2.0 // indirect
github.com/libp2p/go-nat v0.1.0 // indirect github.com/libp2p/go-nat v0.1.0 // indirect
github.com/libp2p/go-netroute v0.2.0 // indirect github.com/libp2p/go-netroute v0.2.0 // indirect

View File

@ -33,7 +33,7 @@ func FromFile(path string, def interface{}) (interface{}, error) {
// FromReader loads config from a reader instance. // FromReader loads config from a reader instance.
func FromReader(reader io.Reader, def interface{}) (interface{}, error) { func FromReader(reader io.Reader, def interface{}) (interface{}, error) {
cfg := def cfg := def
_, err := toml.DecodeReader(reader, cfg) _, err := toml.NewDecoder(reader).Decode(cfg)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -11,9 +11,9 @@ import (
"github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol" "github.com/libp2p/go-libp2p-core/protocol"
swarm "github.com/libp2p/go-libp2p-swarm"
basichost "github.com/libp2p/go-libp2p/p2p/host/basic" basichost "github.com/libp2p/go-libp2p/p2p/host/basic"
"github.com/libp2p/go-libp2p/p2p/net/conngater" "github.com/libp2p/go-libp2p/p2p/net/conngater"
"github.com/libp2p/go-libp2p/p2p/net/swarm"
"github.com/libp2p/go-libp2p/p2p/protocol/ping" "github.com/libp2p/go-libp2p/p2p/protocol/ping"
ma "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr"
"go.uber.org/fx" "go.uber.org/fx"

View File

@ -6,7 +6,7 @@ import (
"github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p"
coredisc "github.com/libp2p/go-libp2p-core/discovery" coredisc "github.com/libp2p/go-libp2p-core/discovery"
"github.com/libp2p/go-libp2p-core/routing" "github.com/libp2p/go-libp2p-core/routing"
discovery "github.com/libp2p/go-libp2p-discovery" routingdisc "github.com/libp2p/go-libp2p/p2p/discovery/routing"
) )
func NoRelay() func() (opts Libp2pOpts, err error) { func NoRelay() func() (opts Libp2pOpts, err error) {
@ -24,5 +24,5 @@ func Discovery(router BaseIpfsRouting) (coredisc.Discovery, error) {
return nil, fmt.Errorf("no suitable routing for discovery") return nil, fmt.Errorf("no suitable routing for discovery")
} }
return discovery.NewRoutingDiscovery(crouter), nil return routingdisc.NewRoutingDiscovery(crouter), nil
} }