mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-12 16:26:37 +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"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -301,7 +302,11 @@ func rmr(paths ...string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getVersion() 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 {
|
v = versionRe.ReplaceAllFunc(v, func(s []byte) []byte {
|
||||||
s[0] = '+'
|
s[0] = '+'
|
||||||
return s
|
return s
|
||||||
@ -310,7 +315,11 @@ func getVersion() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func buildStamp() int64 {
|
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)
|
s, _ := strconv.ParseInt(string(bs), 10, 64)
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user