-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After introducing modules github.com/prometheus/prometheus should become github.com/prometheus/prometheus/v2 #8417
Comments
The consequence of this is also https://pkg.go.dev/github.com/prometheus/prometheus not showing a proper version listing and showing |
Yes, this is a known issue, which has been discussed extensively. There is no conclusion yet how to deal with this. See #7991, #7663, and what's linked thereof, and even more issues… The root problem here is that prometheus/prometheus uses semantic versioning for the released software product, while Go modules uses semantic versioning for what's essentially the interface of a library. That would not collide if Go modules had chosen a somewhat unique tag naming schema (like An attempt to solve this with tooling is https://github.com/modularise/modularise . https://github.com/modularise shows you a few extracted modules with proper Go modules versioning. The Prometheus team is aware of the problem, but it was decided that we want to wait how this tool and other possible attempts play out before making a call how to address this officially |
We have looked at this during our bug scrub, and decided to close this issue as per above comment. This has been discussed already and it seems practically difficult to stick to semver for our go API's. We have also added that as an agenda point for a future dev summit, where we will discuss it further. |
We will also assess the experience so far with https://github.com/modularise . |
Understood. Just one last question in this subject: are there any intentions to stick to with Go semver from v3 (whenever this happens)? |
As said, semantic versioning of Prometheus server releases is completely orthogonal to versioning of Go packages. Therefore, I see no way how we could make it the same from v3 onwards. |
If you need to use v2.24.1 for some reason immediately, you can use a tag on my fork based on this branch: master...DeviaVir:v2.24.1-v2-branch The tag is https://github.com/DeviaVir/prometheus/releases/tag/v2.24.1 and you can use it in your go.mod as follows:
This is obviously just a "hack" to allow you to use prometheus inside your modules, I hope the prometheus team is able to work out the problems they face. |
What did you do?
Create minimal module using one of packages under
github.com/prometheus/prometheus
main.go
go.mod
Run
go mod tidy
Notice that
v2.5.0+incompatible
was added togo.mod
(notv2.24.1
which is the latest tag as of Jan 28 2021).This is because
v2.5.0
was the last version that didn't support modules.Now try to bump this version to any of the subsequent ones: e.g.
v2.6.0
which introduced modules refSo
go.mod
changes to this:and we get this
According to https://blog.golang.org/using-go-modules#TOC_5.
So to my understanding
github.com/prometheus/prometheus
should becomegithub.com/prometheus/prometheus/v2
ingo.mod
module declaration.This will allow other projects that support Go modules to use Prometheus Go modules.
What did you expect to see?
No errors running
go mod tidy
What did you see instead? Under which circumstances?
See above
Environment
N/A
N/A
N/A
N/A
The text was updated successfully, but these errors were encountered: