I don't think changing the module name would be a good idea for singletons tho.
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.
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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.
On Thursday, February 22, 2018 at 5:29:23 PM UTC+8, Axel Wagner wrote: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.Yup, the package I'm working on really cannot have 2 instances even in different import paths as it deals with a shared resource and code that must be run on the main thread.So I have to choose between daisy chaining v1 to v2 to v3 etc.. or have a central v0 where all the v1, v2, etc.. packages import.
Daisy chaining would mean I would only have to code API translations for the latest API but then it's debug hell and if one version in the chain breaks,it means fixing all the newer versions. Also there's a performance hit going through many translations.
Having a v0 means non of all the daisy chaining problems but it means more work when there's a breaking change as then I'll have to update all versions.
Also it means that all version packages have to be from the same release or it breaks.If I just have one module at the root, is it right to assume all sub packages would be of the same commit and that there will be only one version of the module?
--
Daisy chaining would mean I would only have to code API translations for the latest API but then it's debug hell and if one version in the chain breaks,it means fixing all the newer versions. Also there's a performance hit going through many translations.I don't believe so. There's may be an increase in compile time though.
The real question though, is how other package management semantics would solve this better. Is this actually accidental complexity or just systematic complexity caused by "I need to both break compatibility *and* have different versions coexist *and* still share Singleton state between them?
Yup, the package I'm working on really cannot have 2 instances even in different import paths as it deals with a shared resource and code that must be run on the main thread.So I have to choose between daisy chaining v1 to v2 to v3 etc.. or have a central v0 where all the v1, v2, etc.. packages import.Daisy chaining would mean I would only have to code API translations for the latest API but then it's debug hell and if one version in the chain breaks,it means fixing all the newer versions. Also there's a performance hit going through many translations.