client_golang
client_golang copied to clipboard
Installing examples is not working anymore
I am trying to install the examples with the command below:
$ go install github.com/prometheus/client_golang/examples/random@latest
but I am getting the following error:
go: github.com/prometheus/client_golang/examples/random@latest (in github.com/prometheus/[email protected]):
The go.mod file for the module providing named packages contains one or
more exclude directives. It must not contain directives that would cause
it to be interpreted differently than if it were the main module.
This was working with the previous version:
go install github.com/prometheus/client_golang/examples/[email protected]
I assume the changes introduced here https://github.com/prometheus/client_golang/pull/1062 are the reason. Especially this line: https://github.com/prometheus/client_golang/blob/main/go.mod#L31
My Go Version:
go version go1.18.1 darwin/arm64
Maybe we need the examples to use their own go.mod? But that might lead to weird situations…
Or we can reconsider the exclude directive? IIRC it was only added to silence buggy security scanners (that would be confused by the dependency resolution method of Go Modules when faced with circular dependencies).
Both the strategies make sense. With the new Go workspace features having different modules in a project should be rather easier. Also, we might already have deprecated the need for the exclude, if I'm not mistaken we have bumped the minimum required Go version since then. And the issue was related to the older Go version. (I might misremembering things).
I've started taking a look at this issue to see if I can help.
- I'm pretty new to workspaces. Should
go.workbe committed, or should I add an entry to.gitignore? - After I've made my changes how do I validate that I've solved the original issue?
Hello 👋 Looks like there was no activity on this issue for the last 3 months. Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗 If there will be no activity in the next 4 weeks, this issue will be closed (we can always reopen an issue if we need!).
Closing for now as promised, let us know if you need this to be reopened! 🤗