-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
v2 go module semantic versioning #2826
Comments
Yes this was expected and unfortunately is (IMO) a limitation and annoyance with Go mod. I don't think it's appropriate that Go mod scans repos and uses tags to assign versions, this really limits what we can do for versioning a project which was never built with the intention of being a library. We made the decision to use the 2.0.0 tag knowing it would break go mod. Sadly, your use case is completely acceptable and we want to encourage people to use things like the promtail client package in their code. However, we want the ability to control the Loki version number as it feels appropriate to us and the feature set in the project, not as it pertains to it's use as a go library. This creates a dilemma for us, and we chose to go the path of tying the version number to the project state and features, not to the use as a library. We appreciate this issue, apologies for my long response but you were lucky to be the first to find this 😃 and I want to have something to reference when others find this problem too! The workaround is to install Loki based on commit hashes now and not version tags. The commit hash for the 2.0.0 tag is
I know this is not ideal, and we are considering alternatives for something like the client package you are using maybe it makes sense to put this in a separate repo, we are still undecided here. Thank you for reporting this, sorry if my answer is not what you were hoping for! |
I completely agree that this is a limitation and major annoyance while working with go modules, but it seems that they have become de-facto standard nowadays. And thank you for the workaround, this should work for the time being. |
This probably makes sense. If the overhead of managing multiple repositories is too big one could import the promtail repo as a submodule or subrepo. |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Still relevant. |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
If using the commit hash is the official workaround for now, is it possible to include it somewhere in the notes? I tried pulling v2.1.0 with |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Actually we don't have to create subdirectories or anything to make it module compatible. The idea of subdirectory comes from the official blog (which is unfortunate). because during that time, creating subdirectory was the only way for old go tools chain to understand the go modules semantics. If we don't care about that (no one shouldn't anymore, particularly Loki shouldn't), we can just change our module path in e.g: we just have to change our go.mod in v2 branch and add "/v2" in our module path(it becomes This practice is covered in Go Wiki. https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher Also as a proof of concept I created this repository with multiple major versions (with separate branch) and involving only change in module path (no subdirectories or anything) https://github.com/kavirajk/v And usage here https://play.golang.org/p/ZVumxvdSw1L I can create a PR to see if anything else breaks! // @grafana/loki-team @slim-bean |
Was separate client idea abandoned? I see some work being done here, but not so much recently. Semantic versioning isn't the only problem when using go client. |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
* Add -store.max-query-length support to blocks storage Signed-off-by: Marco Pracucci <[email protected]> * Added PR number to CHANGELOG Signed-off-by: Marco Pracucci <[email protected]> * Update pkg/util/validation/limits.go Signed-off-by: Marco Pracucci <[email protected]> Co-authored-by: Peter Štibraný <[email protected]> * Updated doc Signed-off-by: Marco Pracucci <[email protected]> Co-authored-by: Peter Štibraný <[email protected]>
[cross posting here for more context from #4352] Even if we decide to go with supporting our module path with major version, I think this can happen only on next major release (say Loki v3). Purely because of technical reasons mentioned on the Go wiki
|
Note: their v2 numbering is flawed: grafana/loki#2826, so to update specify main: ``` go get -u github.com/grafana/loki@main ``` To sanity-check, on pcn-staging: ``` make build /Users/kcantu/panw/tracer/tracer --monitoring-url="https://monitoring.staging.network.prismacloud.io" --monitoring-cert="$HOME/.tracer/staging-cert.pem" --monitoring-cert-key="$HOME/.tracer/staging-key.pem" --since 1h /Users/kcantu/panw/tracer/tracer --monitoring-url="https://monitoring.staging.network.prismacloud.io" --monitoring-cert="$HOME/.tracer/staging-cert.pem" --monitoring-cert-key="$HOME/.tracer/staging-key.pem" --open 0dc1574097540bd5 ```
This appears to be required, see grafana/loki#2826
Workaround: go.mod
main.go
|
Releasing v3 would be amazing, ty |
Has been addressed with Loki 3.0 release |
Describe the bug
I'm using go client library (
/pkg/promtail/client
) instead of promtail to push log entries to Loki.After updating Loki to v2.0.0 I cannot use go client library in projects with
go.mod
because Loki's module path does not contain/v2
suffix as required by the go command.To Reproduce
mkdir myproject && cd myproject
go mod init myproject
go get github.com/grafana/[email protected]
Expected behavior
Be able to use Loki v2 go client library in projects with
go.mod
file (module-aware mode).Environment:
local, linux
Screenshots, Promtail config, or terminal output
go get github.com/grafana/[email protected]: github.com/grafana/[email protected]: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2
The text was updated successfully, but these errors were encountered: