A brief PSA:

If you are adopting modules with an existing v2+ package, the recommended 
best practice for most cases is to increment the major version when first 
adopting modules. 

For example, if you are on already on v2.2.0, then you would use v3.0.0 for 
your first release with modules. 

Part of the rationale is that it makes the resulting behavior easier to 
understand for both the consumer and publisher. See 
https://github.com/golang/go/issues/25967#issuecomment-422828770 for more 
discussion, if interested.

Some related community tools and references:

1. https://github.com/marwan-at-work/mod is a community tool that automates 
the process of adopting modules for a v2+ package. It also automates any 
subsequent upgrade of a module's major version. In both cases, it 
automatically adjusts go.mod files and related import statements in Go 
source code (adding or adjusting the '/vN' as needed). A "Go Modules by 
Example" walkthrough demonstrates using it: 

    
https://github.com/go-modules-by-example/index/blob/master/015_semantic_import_versioning/README.md

2. Mark Bates recently put out a nicely done video that describes how to 
adopt modules from the perspective of a package maintainer. He runs through 
several options and examples. One of the examples he uses is how things are 
more confusing if the above best practice above is not followed, and how 
things are easier to understand if instead that best practice is followed. 
The video is here, and I recommend it if you are a package maintainer 
considering modules:
   
    https://www.gopherguides.com/videos/go-modules-package-maintainers
  
3. The "Modules" wiki hits on these points as well, including with some 
additional rationale and discussion in these two sections:

    https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher
    https://github.com/golang/go/wiki/Modules#semantic-import-versioning
   
 Finally, I am just a member of the community sharing my personal 
understanding. I am more than happy to learn more if people have a 
different understanding.
 
 Regards,
 thepudds

-- 
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.

Reply via email to