franck102
franck102

Reputation: 341

Are Go modules really usable today given third party "incompatible" modules?

I am new to Go and trying to create my first program. Following the various getting started & tutorials I create a new module, which for my purpose needs to have a dependency on this module:

github.com/timescale/[email protected]

My problem is that the module has dependencies that have not "properly adopted" the semantic versioning approach.

go list -e -m all
...
k8s.io/client-go v12.0.0+incompatible
...

reports 37 such modules... so contacting the module author to have them adopt SIV, as I have seen suggested, will not be an option.

Am I missing something, or should I simply completely give up on using modules for this new project?

Upvotes: 1

Views: 428

Answers (2)

franck102
franck102

Reputation: 341

Thanks for the answers and comments, it seems that:

  1. New project should use modules, +incompatible dependencies will come up but that is fine

  2. This FAQ entry has it right, just read the first 2 lines and keep "Additional Details" for a rainy day

  3. go list -m all won't behave as described in all the tutorials if +incompatible dependencies exist, it will choke on the first incompatible module instead.

go list -m -e all seems to work as expected.

If you are using Goland, using GOFLAGS=-e seems to make dependency resolution work despite +incompatible modules. This may well have side effects that I am not aware of.

Upvotes: 0

Volker
Volker

Reputation: 42433

Are Go modules really usable today given third party "incompatible" modules?

Yes.

Am I missing something

Maybe: This "+incompabtible" is not a sign of failure.

or should I simply completely give up on using modules for this new project?

No, of course not.

Upvotes: 2

Related Questions