diff --git a/sv/git.go b/sv/git.go index 709d336..b126b31 100644 --- a/sv/git.go +++ b/sv/git.go @@ -13,10 +13,13 @@ import ( ) const ( - logSeparator = "##" - endLine = "~~" - breakingChangesKey = "breakingchange" - issueIDKey = "issueid" + logSeparator = "##" + endLine = "~~" + + // BreakingChangesKey key to breaking change metadata + BreakingChangesKey = "breakingchange" + // IssueIDKey key to issue id metadata + IssueIDKey = "issueid" ) // Git commands @@ -52,7 +55,7 @@ type GitImpl struct { // NewGit constructor func NewGit(breakinChangePrefixes, issueIDPrefixes []string, tagPattern string) *GitImpl { return &GitImpl{ - messageMetadata: map[string][]string{breakingChangesKey: breakinChangePrefixes, issueIDKey: issueIDPrefixes}, + messageMetadata: map[string][]string{BreakingChangesKey: breakinChangePrefixes, IssueIDKey: issueIDPrefixes}, tagPattern: tagPattern, } } diff --git a/sv/releasenotes.go b/sv/releasenotes.go index 5389f1f..8b7ed08 100644 --- a/sv/releasenotes.go +++ b/sv/releasenotes.go @@ -62,7 +62,7 @@ func (p ReleaseNoteProcessorImpl) Create(version semver.Version, date time.Time, section.Items = append(section.Items, commit) sections[commit.Type] = section } - if value, exists := commit.Metadata[BreakingChangeTag]; exists { + if value, exists := commit.Metadata[BreakingChangesKey]; exists { breakingChanges = append(breakingChanges, value) } } diff --git a/sv/semver.go b/sv/semver.go index 1c0523c..8350bda 100644 --- a/sv/semver.go +++ b/sv/semver.go @@ -24,9 +24,6 @@ func ToVersion(value string) (semver.Version, error) { return *v, nil } -// BreakingChangeTag breaking change tag from commit metadata -const BreakingChangeTag string = "breakingchange" - // SemVerCommitsProcessor interface type SemVerCommitsProcessor interface { NextVersion(version semver.Version, commits []GitCommitLog) semver.Version @@ -72,7 +69,7 @@ func (p SemVerCommitsProcessorImpl) NextVersion(version semver.Version, commits } func (p SemVerCommitsProcessorImpl) versionTypeToUpdate(commit GitCommitLog) versionType { - if _, exists := commit.Metadata[BreakingChangeTag]; exists { + if _, exists := commit.Metadata[BreakingChangesKey]; exists { return major } if _, exists := p.MajorVersionTypes[commit.Type]; exists {