Skip to content

Commit

Permalink
Changed IF to SWITCH to be more clean
Browse files Browse the repository at this point in the history
  • Loading branch information
benyanke committed May 31, 2018
1 parent 0cdad73 commit 07ba631
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
3 changes: 0 additions & 3 deletions TODO.md

This file was deleted.

18 changes: 10 additions & 8 deletions glauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,22 @@ func getVersionString() string {

versionstr = "GLauth"

if GitClean == "1" && GitTagIsCommit == "1" {
// If a release, use the tag
// Notate the git context of the build
switch {
// If a release, use the tag
case GitClean == "1" && GitTagIsCommit == "1":
versionstr += " " + LastGitTag + "\n\n"

} else if len(GitBranch) > 1 && len(LastGitTag) > 1 {
// If this branch had a tag before, mention the branch and the tag to give a rough idea of the base version
// If this branch had a tag before, mention the branch and the tag to give a rough idea of the base version
case len(GitBranch) > 1 && len(LastGitTag) > 1:
versionstr += "\nNon-release build from branch " + GitBranch + ", based on tag " + LastGitTag + "\n\n"

} else if len(GitBranch) > 1 {
// If no previous tag specified, just mention the branch
// If no previous tag specified, just mention the branch
case len(GitBranch) > 1:
versionstr += "\nNon-release build from branch " + GitBranch + "\n\n"

} else {
// Fallback message, if all else fails
// Fallback message, if all else fails
default:
versionstr += "\nNon-release build\n\n"
}

Expand Down

0 comments on commit 07ba631

Please sign in to comment.