I have good experiences with trunk based development meaning that “master” (we use “main”) is the main development line and you down-port to release branches with cherry picking and tags. So as soon as you commit something which is considered a major change (requiring a new version) then also append /v2 to your module name in go.mod. Branch off a v1 before that commit. But for me the only interesting version is the latest version and such a v1 branch soon is a dead end with no activity. When you really have to maintain older versions for a long time then you may consider a different approach.
Marcin Romaszewicz <marc...@gmail.com> schrieb am Do. 8. Apr. 2021 um 01:43: > Hi All, > > I need to release a V2 of my module. ( > https://github.com/deepmap/oapi-codegen). I understand what to do on the > Go side in terms of the /v2 suffix and go.mod changes, but I'm a little bit > unclear how this works w.r.t git branches. Yes, I've looked at > https://golang.org/ref/mod#vcs-find > > My plan is to do development in a "v2" branch, which which will > occasionally be rebased onto the "master" branch until that's no longer > feasible, at which point I'll cherry pick or port important commits from > master to v2. > > The v2 branch will start off with an annotated tag named "v2.0.0-alpha". > and will begin to diverge from master, which is tagged with v1.x.x > > When I am ready to release the V2 branch, I plan to do the following. > > Top commit in master becomes a new branch, "v1", and any future V1 bug > fixes go here. > > I will merge the V2 branch into master, and tag it as v2.0.0. > > Does this sounds like a reasonable plan? I would like, for the time being, > for people to be able to work on V1 in master, and eventually master will > become V2 while V1 is a branch. > > My alternative is to create a V1 branch today, and all future work in > master is V2. > > > -- Marcin > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CA%2Bv29LuBN-Z8V9xmkzNM1DmMowjtV4XsqOboRtY9pO%2BGYZ5ufw%40mail.gmail.com > <https://groups.google.com/d/msgid/golang-nuts/CA%2Bv29LuBN-Z8V9xmkzNM1DmMowjtV4XsqOboRtY9pO%2BGYZ5ufw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CALWqRZoCHxOrx0WgfkCtRTHypHy9%3DbTjwNzo-UQO3jS-snAQHg%40mail.gmail.com.