mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +00:00
Build without git
This commit is contained in:
parent
93ac1605bd
commit
baf4cc225e
13
build.go
13
build.go
@ -35,6 +35,7 @@ import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -301,7 +302,11 @@ func rmr(paths ...string) {
|
||||
}
|
||||
|
||||
func getVersion() string {
|
||||
v := run("git", "describe", "--always", "--dirty")
|
||||
ecmd := exec.Command("git", "describe", "--always", "--dirty")
|
||||
v, err := ecmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return "unknown-dev"
|
||||
}
|
||||
v = versionRe.ReplaceAllFunc(v, func(s []byte) []byte {
|
||||
s[0] = '+'
|
||||
return s
|
||||
@ -310,7 +315,11 @@ func getVersion() string {
|
||||
}
|
||||
|
||||
func buildStamp() int64 {
|
||||
bs := run("git", "show", "-s", "--format=%ct")
|
||||
ecmd := exec.Command("git", "show", "-s", "--format=%ct")
|
||||
bs, err := ecmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return time.Now().Unix()
|
||||
}
|
||||
s, _ := strconv.ParseInt(string(bs), 10, 64)
|
||||
return s
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user