On Thu, Feb 22, 2018 at 7:18 AM <alex.rou...@gmail.com> wrote: > I don't think changing the module name would be a good idea for singletons > tho. >
Have you read https://research.swtch.com/vgo-import? It talks about singletons and also how to solve that with different import paths. Note, that this is also independent of *how* the different import paths are represented and distributed; for singletons it only matters what import paths the compiler sees, whether they are committed physical directories or whether the vgo tool automatically resolves them. > And having a v0 has the added benefit of using newer codes while > maintaining backwards compatible API. > So no more backporting and all the mess of having multiple branches. > If you don't want multiple branches, you can commit your version-directories and keep the same module name for all of them. If you prefer having a single directory and different branches for different version, you can have the version in the module line instead. To the compiler, both are equivalent, the tool will resolve them to the same thing. > > On Thursday, February 22, 2018 at 1:49:53 PM UTC+8, Sam Whited wrote: >> >> On Wed, Feb 21, 2018, at 22:35, alex....@gmail.com wrote: >> > vgo suggested that package developers put the major version into the >> import >> > path e.g. foo/v1. >> > However dealing with a VCS like git, this thought occur to me, what >> would >> > it look like when the project needs to move from v1 to v2? >> >> This wasn't clear to me either, but it was pointed out that you can just >> change the "module" line in your go.mod file, eg. >> >> module "example.net/mypackage/v2" >> >> and you don't have to actually create a /v2 tree or move your code around >> at all. >> >> —Sam >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.