Error installing github.com/prometheus/client_golang@master

57 views
Skip to first unread message

Zhao Shuxin

unread,
May 18, 2021, 4:18:22 PM5/18/21
to Prometheus Users
Hi folks,

My project has a dependency on github.com/prometheus/client_golang@master. I got following error when installing my project

$ dep init; dep ensure -v -add "my project"
[INFO] failed to handle solve conflicts: No versions of github.com/cespare/xxhash met constraints:
v2.1.1: Could not introduce github.com/cespare/xxh...@v2.1.1, as its subpackage github.com/cespare/xxhash/v2 is missing. (Package is required by github.com/prometheus/client_golang@master.)
v2.1.0: Could not introduce github.com/cespare/xxh...@v2.1.0, as its subpackage github.com/cespare/xxhash/v2 is missing. (Package is required by github.com/prometheus/client_golang@master.)
v2.0.0: Could not introduce github.com/cespare/xxh...@v2.0.0, as its subpackage github.com/cespare/xxhash/v2 is missing. (Package is required by github.com/prometheus/client_golang@master.)
v1.1.0: Could not introduce github.com/cespare/xxh...@v1.1.0, as its subpackage github.com/cespare/xxhash/v2 is missing. (Package is required by github.com/prometheus/client_golang@master.)
v1.0.0: Could not introduce github.com/cespare/xxh...@v1.0.0, as its subpackage github.com/cespare/xxhash/v2 is missing. (Package is required by github.com/prometheus/client_golang@master.)
master: Could not introduce github.com/cespare/xxhash@master, as its subpackage github.com/cespare/xxhash/v2 is missing. (Package is required by github.com/prometheus/client_golang@master.)

github.com/cespare/xxhash is required by github.com/prometheus/client_golang@master

Did you know what could go wrong? Thanks for your help!

Cheers,
Shuxin

Bjoern Rabenstein

unread,
May 25, 2021, 1:51:02 PM5/25/21
to Zhao Shuxin, Prometheus Users
You are using dep, which is deprecated. From
https://github.com/golang/dep: "As of 2020, Dep is deprecated and
archived in favor of Go modules, which have had official support since
Go 1.11. For more details, see https://golang.org/ref/mod."

The above error happens because of the way Go modules deals with major
versions beyond 1.x. (And github.com/cespare/xxhash/v2 is a Go module
with v2.x.) That's not understood by dep.

You have to either use Go modules or do something manual to get your
dependencies into place.
--
Björn Rabenstein
[PGP-ID] 0x851C3DA17D748D03
[email] bjo...@rabenste.in
Reply all
Reply to author
Forward
0 new messages