-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include bin info (commit hash and if changed) on tool (#90)
- Loading branch information
1 parent
c493fe4
commit 2e640a2
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package main | ||
|
||
import ( | ||
"strconv" | ||
"strings" | ||
) | ||
|
||
// Vars only for git sha and diff handling | ||
var GitSHA1 string = "" | ||
var GitDirty string = "0" | ||
|
||
// internal function to return value of GitSHA1 var, which is filled in link time | ||
func toolGitSHA1() string { | ||
return GitSHA1 | ||
} | ||
|
||
// this internal function will check for the number of altered lines that are not yet committed | ||
// and return true in that case | ||
func toolGitDirty() (dirty bool) { | ||
dirty = false | ||
dirtyLines, err := strconv.Atoi(strings.TrimSpace(GitDirty)) | ||
if err == nil { | ||
dirty = (dirtyLines != 0) | ||
} | ||
return | ||
} |
This file contains 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