add automatic version string based on git-describe (tags)
This commit is contained in:
parent
46edad2748
commit
2fe2d9ac62
4
Makefile
4
Makefile
|
@ -120,10 +120,10 @@ dep:
|
||||||
|
|
||||||
# Build binary
|
# Build binary
|
||||||
build:
|
build:
|
||||||
GO111MODULE=on go build
|
GO111MODULE=on go build -ldflags="-X github.com/zcash/lightwalletd/common.Version=`git describe --tags`"
|
||||||
|
|
||||||
build_rel:
|
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 binaries into Go path
|
||||||
install:
|
install:
|
||||||
|
|
|
@ -182,7 +182,7 @@ func startServer(opts *common.Options) error {
|
||||||
os.Exit(1)
|
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)
|
err = server.Serve(listener)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/zcash/lightwalletd/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// versionCmd represents the version command
|
// versionCmd represents the version command
|
||||||
|
@ -12,6 +13,6 @@ var versionCmd = &cobra.Command{
|
||||||
Short: "Dispaly lightwalletd version",
|
Short: "Dispaly lightwalletd version",
|
||||||
Long: `Dispaly lightwalletd version.`,
|
Long: `Dispaly lightwalletd version.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Println("lightwalletd version v0.2.0")
|
fmt.Println("lightwalletd version", common.Version)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -16,6 +16,9 @@ import (
|
||||||
"github.com/zcash/lightwalletd/walletrpc"
|
"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 {
|
type Options struct {
|
||||||
BindAddr string `json:"bind_address,omitempty"`
|
BindAddr string `json:"bind_address,omitempty"`
|
||||||
TLSCertPath string `json:"tls_cert_path,omitempty"`
|
TLSCertPath string `json:"tls_cert_path,omitempty"`
|
||||||
|
|
Loading…
Reference in New Issue