allow non-git make

This commit is contained in:
Josh Baker 2016-03-13 16:39:04 -07:00
parent 6b3e02e7cd
commit 7ab4051af3
2 changed files with 9 additions and 3 deletions

View File

@ -6,7 +6,9 @@ PROTECTED_MODE="no"
# Hardcode some values to the core package
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.Version=${VERSION}"
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.GitSHA=$(git rev-parse --short HEAD)"
if [ -d ".git" ]; then
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.GitSHA=$(git rev-parse --short HEAD)"
fi
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.BuildTime=$(date +%FT%T%z)"
if [ "$PROTECTED_MODE" == "no" ]; then
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.ProtectedMode=no"

View File

@ -73,6 +73,10 @@ func main() {
if host != "" {
hostd = "Addr: " + host + ", "
}
gitsha := " (" + core.GitSHA + ")"
if gitsha == " (0000000)" {
gitsha = ""
}
// _____ _ _ ___ ___
// |_ _|_| |___|_ | . |
@ -82,12 +86,12 @@ func main() {
fmt.Fprintf(logw, `
_______ _______
| | |
|____ | _ | Tile38 %s (%s) %d bit (%s/%s)
|____ | _ | Tile38 %s%s %d bit (%s/%s)
| | | %sPort: %d, PID: %d
|____ | _ |
| | | tile38.com
|_______|_______|
`+"\n", core.Version, core.GitSHA, strconv.IntSize, runtime.GOARCH, runtime.GOOS, hostd, port, os.Getpid())
`+"\n", core.Version, gitsha, strconv.IntSize, runtime.GOARCH, runtime.GOOS, hostd, port, os.Getpid())
if err := controller.ListenAndServe(host, port, dir); err != nil {
log.Fatal(err)