wealdtech / go-ens

Apache License 2.0
90 stars 33 forks source link

found package github.com/btcsuite/btcd/chaincfg/chainhash in multiple modules #22

Closed jxlwqq closed 2 years ago

jxlwqq commented 2 years ago

when I update deps:

go get -u ./...

returns:

go get -u ./...
go: upgraded github.com/btcsuite/btcd v0.22.0-beta => v0.22.1
go: added github.com/btcsuite/btcd/btcec/v2 v2.2.0
go: added github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1
go: upgraded github.com/ethereum/go-ethereum v1.10.15 => v1.10.17
go: upgraded github.com/gorilla/websocket v1.4.2 => v1.5.0
go: upgraded github.com/ipfs/go-cid v0.1.0 => v0.2.0
go: upgraded github.com/klauspost/cpuid/v2 v2.0.11 => v2.0.12
go: upgraded github.com/tklauser/go-sysconf v0.3.9 => v0.3.10
go: upgraded github.com/tklauser/numcpus v0.4.0 => v0.5.0
go: upgraded golang.org/x/crypto v0.0.0-20220213190939-1e6e3497d506 => v0.0.0-20220518034528-6f7dac969898
go: upgraded golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd => v0.0.0-20220520000938-2e3eb7b945c2
go: upgraded golang.org/x/sys v0.0.0-20220209214540-3681064d5158 => v0.0.0-20220520151302-bc2c85ada10a

but, when I try to run go mod tidy:

returns:

ens imports
        github.com/ethereum/go-ethereum/ethclient imports
        github.com/ethereum/go-ethereum/core/types imports
        github.com/ethereum/go-ethereum/crypto imports
        github.com/btcsuite/btcd/btcec/v2/ecdsa tested by
        github.com/btcsuite/btcd/btcec/v2/ecdsa.test imports
        github.com/btcsuite/btcd/chaincfg/chainhash: ambiguous import: found package github.com/btcsuite/btcd/chaincfg/chainhash in multiple modules:
        github.com/btcsuite/btcd v0.22.0-beta (/Users/jxlwqq/go/pkg/mod/github.com/btcsuite/btcd@v0.22.0-beta/chaincfg/chainhash)
        github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 (/Users/jxlwqq/go/pkg/mod/github.com/btcsuite/btcd/chaincfg/chainhash@v1.0.1)
mcdee commented 2 years ago

There is no reason to update the dependencies locally. Upgrades can cause dependency issues, as you have found, and packages like go-ethereum commonly change their public-facing functions even in patch releases. Best to stick with the package versions as currently set in the repository.

lukekim commented 2 years ago

We're also seeing this issue. It's not a matter of just not updating dependencies, adding go-ens to our project, then doing go mod tidy twice will reproduce the error.

Other packages also seeing the error: https://github.com/btcsuite/btcd/issues/1839

TL;DR: Run go get github.com/btcsuite/btcd; go get github.com/btcsuite/btcd/btcec/v2

mcdee commented 2 years ago

I have updated the dependencies for this module so that it uses the latest packages, which (assuming that dependencies have addressed the issue) should solve this. The release is v3.5.5