diff options
author | vasser <serhiy.vas@gmail.com> | 2023-01-18 22:40:36 +0200 |
---|---|---|
committer | vasser <serhiy.vas@gmail.com> | 2023-01-18 22:40:36 +0200 |
commit | 61bfe18f83e3d9a838893d84eed8fd838837968d (patch) | |
tree | b8be195b1820558f64a655fdab45454d78a2e870 /commands/root.go | |
parent | 68dcbab83391336ca129d382b7ab75ef9eadf591 (diff) | |
download | git-bug-61bfe18f83e3d9a838893d84eed8fd838837968d.tar.gz |
dirty should be bool
Diffstat (limited to 'commands/root.go')
-rw-r--r-- | commands/root.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/commands/root.go b/commands/root.go index f8eda136..80da9e89 100644 --- a/commands/root.go +++ b/commands/root.go @@ -53,7 +53,7 @@ the same git remote you are already using to collaborate with other people. if commit, dirty, err := getCommitAndDirty(); err == nil { root.Version = fmt.Sprintf("dev-%.10s", commit) - if dirty != "" { + if dirty { root.Version = fmt.Sprintf("%s-dirty", root.Version) } } else { @@ -112,13 +112,14 @@ func Execute() { } } -func getCommitAndDirty() (commit, dirty string, err error) { - var d, c string +func getCommitAndDirty() (commit string, dirty bool, err error) { + var c string + var d bool info, ok := debug.ReadBuildInfo() if !ok { - return d, c, errors.New("unable to read build info") + return c, d, errors.New("unable to read build info") } // get the commit and modified status @@ -129,7 +130,7 @@ func getCommitAndDirty() (commit, dirty string, err error) { c = kv.Value case "vcs.modified": if kv.Value == "true" { - d = "dirty" + d = true } } } |