Compare commits

...
3 Commits
2 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -1 +1 @@
v0.1.42
v0.1.43
+16
View File
@@ -4,6 +4,7 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
@@ -69,10 +70,25 @@ func navigateToRepoRootDirectory() {
}
}
// when building the binary, `version` is set as a compile-time variable, along
// with `date` and `commit`. If this program has been opened directly via go,
// we will populate the `version` with VERSION in the lazygit root directory
func fallbackVersion() string {
gopath := os.Getenv("GOPATH")
byteVersion, err := ioutil.ReadFile(gopath + "/src/github.com/jesseduffield/lazygit/VERSION")
if err != nil {
return "unversioned"
}
return string(byteVersion)
}
func main() {
startTime = time.Now()
devLog("\n\n\n\n\n\n\n\n\n\n")
flag.Parse()
if version == "unversioned" {
version = fallbackVersion()
}
if *versionFlag {
fmt.Printf("commit=%s, build date=%s, version=%s", commit, date, version)
os.Exit(0)