August 2019
Beginner to intermediate
798 pages
17h 2m
English
In this subsection, we are going to create the second major version of myModule. Note that for major versions, you will need to be explicit in your import statements.
So github.com/mactsouk/myModule will become github.com/mactsouk/myModule/v2 for version v2 and github.com/mactsouk/myModule/v3 for v3.
The first thing to do is create a new GitHub branch:
$ git checkout -b v2 Switched to a new branch 'v2' $ git push --set-upstream origin v2
Then, you should do the following:
$ vi go.mod
$ cat go.mod
module github.com/mactsouk/myModule/v2
go 1.12
$ git commit -a -m "Using 2.0.0"
[v2 5af2269] Using 2.0.0
2 files changed, 2 insertions(+), 2 deletions(-)
$ git tag v2.0.0
$ git push --tags origin v2
Counting objects: 4, ...Read now
Unlock full access