Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
Fix dependency declaration of Prometheus - I ❤️ Cargo and Rust so much!
Browse files Browse the repository at this point in the history
This is battle between Golang authors and Prometheus authors (probably
some others as well).

Golang requires semantic versioning, and Prometheus doesn't want submit
to those rules:

* With Go 1.13 can no longer flag versions as incompatible, if the have
  a 'go.mod' file in their repository:
golang/go#35732
* Dropping the '+incompatible' suffix is not possible, because the
  module author (Prometheus) would need to add the suffix '/v2'
  to their module. Otherwise you run into:
golang/go#35732 (comment)
* Prometheus doesn't care about Golang's idea of versioning and simply
  ignores it:
prometheus/prometheus#6048 (comment)

You can still put a commit has into the go.mod file as version, but that
gets translated to into a version from the past (for 2.15.2 prometheus
this will resolve into 2.3.x or 1.8.x).

The solution to all of this insanity is, to declare the version you had
in mind in the "requires" section. And then add a mapping entry into
the "replace" section, pointing to the actual version, using a commit
hash and the "v0.0.0" version.
  • Loading branch information
ctron committed Jun 8, 2020
1 parent 28f0341 commit d335ee0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ replace (
github.com/Azure/go-autorest => github.com/Azure/go-autorest v13.0.0+incompatible
github.com/docker/docker => github.com/moby/moby v0.7.3-0.20190826074503-38ab9da00309
github.com/openshift/api => github.com/openshift/api v0.0.0-20200117162508-e7ccdda6ba67
github.com/prometheus/prometheus => github.com/prometheus/prometheus v0.0.0-20200106144642-d9613e5c466c
k8s.io/api => k8s.io/api v0.0.0-20191016110408-35e52d86657a
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20191016113550-5357c4baaf65
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20191004115801-a2eda9f80ab8
Expand Down
7 changes: 2 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -723,11 +723,8 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8=
github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
github.com/prometheus/prometheus v0.0.0-20180315085919-58e2a31db8de/go.mod h1:oAIUtOny2rjMX0OWN5vPR5/q/twIROJvdqnQKDdil/s=
github.com/prometheus/prometheus v2.3.2+incompatible h1:EekL1S9WPoPtJL2NZvL+xo38iMpraOnyEHOiyZygMDY=
github.com/prometheus/prometheus v2.3.2+incompatible/go.mod h1:oAIUtOny2rjMX0OWN5vPR5/q/twIROJvdqnQKDdil/s=
github.com/prometheus/prometheus v2.15.2+incompatible h1:6xLJiQb4NRmHure9iOQH68bDgL9RtI90TIL77ZGtf/o=
github.com/prometheus/prometheus v2.15.2+incompatible/go.mod h1:7U90zPoLkWjEIQcy/rweQla82OCTUzxVHE51G3OhJbI=
github.com/prometheus/prometheus v0.0.0-20200106144642-d9613e5c466c h1:1wJ3oer23Ou+5Ej+mAs3gpe5Iz6m24sNZPVAlbb7i4A=
github.com/prometheus/prometheus v0.0.0-20200106144642-d9613e5c466c/go.mod h1:7U90zPoLkWjEIQcy/rweQla82OCTUzxVHE51G3OhJbI=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/prometheus/tsdb v0.8.0 h1:w1tAGxsBMLkuGrFMhqgcCeBkM5d1YI24udArs+aASuQ=
github.com/prometheus/tsdb v0.8.0/go.mod h1:fSI0j+IUQrDd7+ZtR9WKIGtoYAYAJUKcKhYLG25tN4g=
Expand Down

0 comments on commit d335ee0

Please sign in to comment.