Multi-version module structure

Hi, i’m working on a package( which supposed to have several versions. Versions code located in vN subpackages and pretty much identical, except for one dependency, which should have different versions. So there’s common code which i keep at package’s root.

My question is, what is best way to reuse code between different versions? Looks like, if common code is located somewhere else in root module, then root module will be considered as dependency and will be present in go.mod . Is there way to avoid that, or should i just replicate code for each version?

Solved that by moving common code into another nested module. Now project is basically single repo for 3 modules:

- /root
     - /common -- common module
     - /v3 -- v3 module
     - /v4 -- v4 module

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.