build: Add git sha to version output
This commit is contained in:
parent
4a652b8f91
commit
0abc772023
8
Makefile
8
Makefile
@ -2,6 +2,13 @@
|
||||
UNAME=$(shell uname)
|
||||
PREFIX=github.com/derekparker/delve
|
||||
GOVERSION=$(shell go version)
|
||||
BUILD_SHA=$(shell git rev-parse HEAD)
|
||||
|
||||
ifeq "$(UNAME)" "Darwin"
|
||||
BUILD_FLAGS=-ldflags="-s -X main.Build=$(BUILD_SHA)"
|
||||
else
|
||||
BUILD_FLAGS=-ldflags="-X main.Build=$(BUILD_SHA)"
|
||||
endif
|
||||
|
||||
# Workaround for GO15VENDOREXPERIMENT bug (https://github.com/golang/go/issues/11659)
|
||||
ALL_PACKAGES=$(shell go list ./... | grep -v /vendor/)
|
||||
@ -13,7 +20,6 @@ ALL_PACKAGES=$(shell go list ./... | grep -v /vendor/)
|
||||
# unable to execute.
|
||||
# See https://github.com/golang/go/issues/11887#issuecomment-126117692.
|
||||
ifeq "$(UNAME)" "Darwin"
|
||||
BUILD_FLAGS=-ldflags="-s"
|
||||
TEST_FLAGS=-exec=$(shell pwd)/scripts/testsign
|
||||
DARWIN="true"
|
||||
endif
|
||||
|
@ -24,6 +24,8 @@ import (
|
||||
|
||||
const version string = "0.10.0-alpha"
|
||||
|
||||
var Build string
|
||||
|
||||
var (
|
||||
Log bool
|
||||
Headless bool
|
||||
@ -59,7 +61,7 @@ The goal of this tool is to provide a simple yet powerful interface for debuggin
|
||||
Use: "version",
|
||||
Short: "Prints version.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("Delve version: " + version)
|
||||
fmt.Printf("Delve Debugger\nVersion: %s\nBuild: %s\n", version, Build)
|
||||
},
|
||||
}
|
||||
rootCommand.AddCommand(versionCommand)
|
||||
|
Loading…
Reference in New Issue
Block a user