From 053be8956490ef3a4a3922da287ee61f3f7df23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Art=C5=ABrs=20J=C4=81nis=20P=C4=93tersons?= Date: Mon, 7 May 2018 10:31:04 +0300 Subject: [PATCH] Fix issue with incorrect tag generation When existing tags were not sorted, next tag was generated incorrectly. See https://github.com/pkg/rock/issues/13 --- cmd/tag.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/tag.go b/cmd/tag.go index 0fb5670..f6eee37 100644 --- a/cmd/tag.go +++ b/cmd/tag.go @@ -61,21 +61,29 @@ var tagCmd = &cobra.Command{ fmt.Println("error: ", err) continue } + fmt.Printf("v%d.%d.%d\n", sv.Major, sv.Minor, sv.Patch) if sv.Major > maxMajor { maxMajor = sv.Major maxMinor = 0 maxPatch = 0 } + if sv.Major < maxMajor { + continue + } + if sv.Minor > maxMinor { maxMinor = sv.Minor maxPatch = 0 } + if sv.Minor < maxMinor { + continue + } + if sv.Patch > maxPatch { maxPatch = sv.Patch } - fmt.Printf("v%d.%d.%d\n", sv.Major, sv.Minor, sv.Patch) } var tagged bool if Major {