Francesc, it sounds like your concern with using modules is this scenario:
- a non-module user imports
github.com/dgraph-io/badger -
github.com/dgraph-io/badgercontains an import forgithub.com/dgraph-io/badger/v2/table - the non-module user’s go command trips over that /v2/ import
But that is not what happens, at least as of Go 1.9.7+, Go 1.10.3+, and Go 1.11+. Those versions of the toolchain (which everyone should have by now) understand that if non-module code finds an import in module code with a /vN/ in it that doesn’t resolve, it should retry without the /vN/.
So yes, you have to update your import paths in your own module. But no, that should not break your non-module users.
See Modules · golang/go Wiki · GitHub for lots of details.
Suggesting that module users ask for v2.0.0+incompatible is problematic for other reasons and really an unfortunate decision.
Edit: It is also fine to do what Andrew suggests. It just depends on whether you want a v2 subdirectory for now or not.