mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Merge pull request #914 from bhandras/ldflags-extended-commit
build+loop: add the commit hash to `GetInfoResponse` and change version semantics
This commit is contained in:
commit
bfe7991c4e
8 changed files with 726 additions and 693 deletions
2
Makefile
2
Makefile
|
|
@ -15,7 +15,7 @@ GOBUILD := GO111MODULE=on go build -v
|
|||
GOINSTALL := GO111MODULE=on go install -v
|
||||
GOMOD := GO111MODULE=on go mod
|
||||
|
||||
COMMIT := $(shell git describe --abbrev=40 --dirty)
|
||||
COMMIT := $(shell git describe --abbrev=40 --dirty | sed -E 's/.*-g([0-9a-f]{40})(-dirty)?/\1\2/')
|
||||
LDFLAGS := -ldflags "-X $(PKG).Commit=$(COMMIT)"
|
||||
DEV_TAGS = dev
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ func fatal(err error) {
|
|||
func main() {
|
||||
app := cli.NewApp()
|
||||
|
||||
app.Version = loop.Version()
|
||||
app.Version = loop.RichVersion()
|
||||
app.Name = "loop"
|
||||
app.Usage = "control plane for your loopd"
|
||||
app.Flags = []cli.Flag{
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ func Run(rpcCfg RPCConfig) error {
|
|||
appName := filepath.Base(os.Args[0])
|
||||
appName = strings.TrimSuffix(appName, filepath.Ext(appName))
|
||||
if config.ShowVersion {
|
||||
fmt.Println(appName, "version", loop.Version())
|
||||
fmt.Println(appName, "version", loop.RichVersion())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ func Run(rpcCfg RPCConfig) error {
|
|||
}
|
||||
|
||||
// Print the version before executing either primary directive.
|
||||
infof("Version: %v", loop.Version())
|
||||
infof("Version: %v", loop.RichVersion())
|
||||
|
||||
lisCfg := NewListenerConfig(&config, rpcCfg)
|
||||
|
||||
|
|
|
|||
|
|
@ -1210,6 +1210,7 @@ func (s *swapClientServer) GetInfo(ctx context.Context,
|
|||
|
||||
return &looprpc.GetInfoResponse{
|
||||
Version: loop.Version(),
|
||||
CommitHash: loop.CommitHash(),
|
||||
Network: s.config.Network,
|
||||
RpcListen: s.config.RPCListen,
|
||||
RestListen: s.config.RESTListen,
|
||||
|
|
|
|||
1385
looprpc/client.pb.go
1385
looprpc/client.pb.go
File diff suppressed because it is too large
Load diff
|
|
@ -1045,6 +1045,11 @@ message GetInfoResponse {
|
|||
Statistics about loop ins.
|
||||
*/
|
||||
LoopStats loop_in_stats = 8;
|
||||
|
||||
/*
|
||||
The git commit hash of the loopd binary.
|
||||
*/
|
||||
string commit_hash = 9;
|
||||
}
|
||||
|
||||
message GetLiquidityParamsRequest {
|
||||
|
|
|
|||
|
|
@ -967,6 +967,10 @@
|
|||
"loop_in_stats": {
|
||||
"$ref": "#/definitions/looprpcLoopStats",
|
||||
"description": "Statistics about loop ins."
|
||||
},
|
||||
"commit_hash": {
|
||||
"type": "string",
|
||||
"description": "The git commit hash of the loopd binary."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
16
version.go
16
version.go
|
|
@ -45,13 +45,25 @@ const (
|
|||
var AgentName = defaultAgentName
|
||||
|
||||
// Version returns the application version as a properly formed string per the
|
||||
// semantic versioning 2.0.0 spec (http://semver.org/) and the commit it was
|
||||
// built on.
|
||||
// semantic versioning 2.0.0 spec (http://semver.org/).
|
||||
func Version() string {
|
||||
// Append commit hash of current build to version.
|
||||
return semanticVersion()
|
||||
}
|
||||
|
||||
// RichVersion returns the application version as a properly formed string
|
||||
// per the semantic versioning 2.0.0 spec (http://semver.org/) and the commit
|
||||
// it was built on.
|
||||
func RichVersion() string {
|
||||
// Append commit hash of current build to version.
|
||||
return fmt.Sprintf("%s commit=%s", semanticVersion(), Commit)
|
||||
}
|
||||
|
||||
// CommitHash returns the commit hash of the current build.
|
||||
func CommitHash() string {
|
||||
return Commit
|
||||
}
|
||||
|
||||
// UserAgent returns the full user agent string that identifies the software
|
||||
// that is submitting swaps to the loop server.
|
||||
func UserAgent(initiator string) string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue