Created
December 30, 2020 20:51
-
-
Save percybolmer/6431b10985c3ab10c1f8183564554a19 to your computer and use it in GitHub Desktop.
A breakout of big swich from main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AddCommitLog will take a commitHash and a commitMessage and append them to their | |
// apropriate Slice | |
func (logContainer *LogsByCategory) AddCommitLog(commitHash, commitMessage string) { | |
message := fmt.Sprintf("%s - %s", commitHash, normalizeCommit(commitMessage)) | |
switch { | |
case strings.Contains(commitMessage, "ci:"): | |
logContainer.CI = append(logContainer.CI, message) | |
case strings.Contains(commitMessage, "fix:"): | |
logContainer.FIX = append(logContainer.FIX, message) | |
case strings.Contains(commitMessage, "refactor:"): | |
logContainer.REFACTOR = append(logContainer.REFACTOR, message) | |
// Golang Switch allows multiple values in cases with , separation | |
case strings.Contains(commitMessage, "feat:"), strings.Contains(commitMessage, "feature:"): | |
logContainer.FEATURE = append(logContainer.FEATURE, message) | |
case strings.Contains(commitMessage, "docs:"): | |
logContainer.DOCS = append(logContainer.DOCS, message) | |
default: | |
logContainer.OTHER = append(logContainer.OTHER, message) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment