From 737561fa8b0acb11852148e76b997e183fbd717f Mon Sep 17 00:00:00 2001 From: tidwall Date: Thu, 15 Nov 2018 13:45:36 -0700 Subject: [PATCH] Fix version not being set at build, close #386 --- build.sh | 8 ++++---- cmd/tile38-server/main.go | 4 ++-- core/options.go | 6 +++--- internal/server/server.go | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build.sh b/build.sh index fbe65ec1..01f847e1 100755 --- a/build.sh +++ b/build.sh @@ -8,13 +8,13 @@ VERSION=1.14.1 PROTECTED_MODE="no" # Hardcode some values to the core package -LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/pkg/core.Version=${VERSION}" +LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.Version=${VERSION}" if [ -d ".git" ]; then - LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/pkg/core.GitSHA=$(git rev-parse --short HEAD)" + LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.GitSHA=$(git rev-parse --short HEAD)" fi -LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/pkg/core.BuildTime=$(date +%FT%T%z)" +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/pkg/core.ProtectedMode=no" + LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.ProtectedMode=no" fi if [ "$1" == "update-version" ]; then diff --git a/cmd/tile38-server/main.go b/cmd/tile38-server/main.go index de876dfd..b77783c6 100644 --- a/cmd/tile38-server/main.go +++ b/cmd/tile38-server/main.go @@ -147,10 +147,10 @@ Developer Options: if i < len(os.Args) { switch strings.ToLower(os.Args[i]) { case "no": - core.ProtectedMode = false + core.ProtectedMode = "no" continue case "yes": - core.ProtectedMode = true + core.ProtectedMode = "yes" continue } } diff --git a/core/options.go b/core/options.go index 97776727..6be8f51d 100644 --- a/core/options.go +++ b/core/options.go @@ -7,16 +7,16 @@ var DevMode = false var ShowDebugMessages = false // ProtectedMode forces Tile38 to default in protected mode. -var ProtectedMode = true +var ProtectedMode = "no" // AppendOnly allows for disabling the appendonly file. var AppendOnly = true // AppendFileName allows for custom appendonly file path -var AppendFileName string +var AppendFileName = "" // QueueFileName allows for custom queue.db file path -var QueueFileName string +var QueueFileName = "" // NumThreads is the number of network threads to use. var NumThreads int diff --git a/internal/server/server.go b/internal/server/server.go index 3ed61699..549fa7c7 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -278,7 +278,7 @@ func Serve(host string, port int, dir string, http bool) error { } func (server *Server) isProtected() bool { - if core.ProtectedMode == false { + if core.ProtectedMode == "no" { // --protected-mode no return false }