diff --git a/Makefile b/Makefile index a3ccba8..a56095a 100644 --- a/Makefile +++ b/Makefile @@ -120,10 +120,10 @@ dep: # Build binary build: - GO111MODULE=on go build + GO111MODULE=on go build -ldflags="-X github.com/zcash/lightwalletd/common.Version=`git describe --tags`" build_rel: - GO111MODULE=on GOOS=linux go build + GO111MODULE=on GOOS=linux go build -ldflags="-X github.com/zcash/lightwalletd/common.Version=`git describe --tags`" # Install binaries into Go path install: diff --git a/cmd/root.go b/cmd/root.go index 856bc8d..3e18028 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -182,7 +182,7 @@ func startServer(opts *common.Options) error { os.Exit(1) }() - common.Log.Infof("Starting gRPC server on %s", opts.BindAddr) + common.Log.Infof("Starting gRPC server version %s on %s", common.Version, opts.BindAddr) err = server.Serve(listener) if err != nil { diff --git a/cmd/version.go b/cmd/version.go index b052407..b8161c6 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/spf13/cobra" + "github.com/zcash/lightwalletd/common" ) // versionCmd represents the version command @@ -12,6 +13,6 @@ var versionCmd = &cobra.Command{ Short: "Dispaly lightwalletd version", Long: `Dispaly lightwalletd version.`, Run: func(cmd *cobra.Command, args []string) { - fmt.Println("lightwalletd version v0.2.0") + fmt.Println("lightwalletd version", common.Version) }, } diff --git a/common/__debug_bin b/common/__debug_bin new file mode 100755 index 0000000..dda9f2f Binary files /dev/null and b/common/__debug_bin differ diff --git a/common/common.go b/common/common.go index d76ace9..6eca701 100644 --- a/common/common.go +++ b/common/common.go @@ -16,6 +16,9 @@ import ( "github.com/zcash/lightwalletd/walletrpc" ) +// 'make build' will overwrite this string with the output of git-describe (tag) +var Version = "v0.0.0.0-dev" + type Options struct { BindAddr string `json:"bind_address,omitempty"` TLSCertPath string `json:"tls_cert_path,omitempty"`