main+lnd: display build.Version() for commit hash

This commit is contained in:
Conner Fromknecht 2018-09-20 03:26:58 -07:00
parent 97fd56cf47
commit 0903fe3183
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7
3 changed files with 8 additions and 7 deletions

View File

@ -21,6 +21,7 @@ import (
"github.com/btcsuite/btcutil"
flags "github.com/jessevdk/go-flags"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/htlcswitch/hodl"
"github.com/lightningnetwork/lnd/lncfg"
"github.com/lightningnetwork/lnd/lnwire"
@ -323,7 +324,7 @@ func loadConfig() (*config, error) {
appName = strings.TrimSuffix(appName, filepath.Ext(appName))
usageMessage := fmt.Sprintf("Use %s -h to show usage", appName)
if preCfg.ShowVersion {
fmt.Println(appName, "version", version())
fmt.Println(appName, "version", build.Version())
os.Exit(0)
}

9
lnd.go
View File

@ -37,6 +37,8 @@ import (
"github.com/btcsuite/btcwallet/wallet"
proxy "github.com/grpc-ecosystem/grpc-gateway/runtime"
flags "github.com/jessevdk/go-flags"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/lncfg"
@ -54,10 +56,6 @@ const (
)
var (
// Commit stores the current commit hash of this build. This should be
// set using -ldflags during compilation.
Commit string
cfg *config
registeredChains = newChainRegistry()
@ -108,7 +106,8 @@ func lndMain() error {
}()
// Show version at startup.
ltndLog.Infof("Version %s", version())
ltndLog.Infof("Version: %s, build=%s, logging=%s",
build.Version(), build.Deployment, build.LoggingType)
var network string
switch {

View File

@ -24,6 +24,7 @@ import (
"github.com/btcsuite/btcwallet/waddrmgr"
"github.com/coreos/bbolt"
"github.com/davecgh/go-spew/spew"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/lnrpc"
@ -1364,7 +1365,7 @@ func (r *rpcServer) GetInfo(ctx context.Context,
Uris: uris,
Alias: nodeAnn.Alias.String(),
BestHeaderTimestamp: int64(bestHeaderTimestamp),
Version: version(),
Version: build.Version(),
}, nil
}