Skip to content
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

module directive in go.mod is missing version number #5356

Closed
exklamationmark opened this Issue Mar 14, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@exklamationmark
Copy link

exklamationmark commented Mar 14, 2019

Proposal

Hi,

I was trying to import some packages from the repos at v2.8.0 and noticed that Go module didn't resolve to the tagged version. Instead, it resolved to a pseudo-version number
(v0.0.0-20190312040920-59369491cfdf).

While the hash is still correct (59369491cfdf is tagged with v2.8.0), it took a while to understand and verify when working with Go module.

The cause was the module directive in go.mod, which didn't match strategies
for release > v2 in Go module.

This is probably not that important if we just want to build the binary. However, it can be annoying when importing packages from Prometheus.

A proper fix would probably need to have the correct major version number in go.mod.
For now, it could simply mean having

module github.com/prometheus/prometheus/v2

Bug Report

What did you do?

Import github.com/prometheus/prometheus/promql and github.com/prometheus/prometheus/storage at version v2.8.0

What did you expect to see?

$ GO111MODULE=on go get -v -x github.com/prometheus/prometheus@v2.8.0
$ cat go.mod | grep 'prometheus/prometheus'
        github.com/prometheus/prometheus v2.8.0 // indirect

What did you see instead? Under which circumstances?

$ GO111MODULE=on go get -v -x github.com/prometheus/prometheus@v2.8.0
$ cat go.mod | grep 'prometheus/prometheus'
        github.com/prometheus/prometheus v0.0.0-20190312040920-59369491cfdf

Environment

  • System information:

    Linux 4.15.0-46-generic x86_64

  • Prometheus version:

    prometheus, version 2.8.0 (branch: HEAD, revision: 5936949)

  • Alertmanager version:

    N/A

  • Prometheus configuration file:

    N/A

  • Alertmanager configuration file:

    N/A

  • Logs:

    N/A

@simonpasquier

This comment has been minimized.

Copy link
Member

simonpasquier commented Mar 14, 2019

We can't (don't want to) guarantee any API stability on the github.com/prometheus/prometheus/* packages so github.com/prometheus/prometheus/pkg/foo@v2.9.0 could break its API compared to v2.8.0 if we need it. Following SemVer and the Go modules conventions would be misleading and worth than the current situation IMHO.

@exklamationmark

This comment has been minimized.

Copy link
Author

exklamationmark commented Mar 14, 2019

I see. Indeed it would be misleading to follow SemVer in that case.
Should we add some notes to about this, or just leave it as is?

@simonpasquier

This comment has been minimized.

Copy link
Member

simonpasquier commented Mar 15, 2019

I'd leave as it is now since the note would probably be hard to find for people anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.