prometheus / alertmanager

Prometheus Alertmanager
https://prometheus.io
Apache License 2.0
6.65k stars 2.16k forks source link

No way to consume the API v2 client code separately from the main module #1983

Open simonpasquier opened 5 years ago

simonpasquier commented 5 years ago

This has been reported in https://github.com/prometheus/prometheus/issues/5813.

TL;DR: if project X wants to consume github.com/prometheus/alertmanager/api/v2/client, it needs to depend on the github.com/prometheus/alertmanager module which pull dependencies that aren't really needed and can conflict with the own requirement constraints of project X.

One solution would be to create a distinct module for the (generated) API v2 code (see https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories).

mxinden commented 5 years ago

I guess we would be within the second sample scenario:

if you have a repository with a complex set of dependencies, but you have a client API with a smaller set of dependencies. In some cases, it might make sense to have an api or clientapi or similar directory with its own go.mod, or to separate out that clientapi into its own repository.

simonpasquier commented 5 years ago

@mxinden yes IMO.