diff --git a/Makefile b/Makefile index 3542f802..09b97490 100644 --- a/Makefile +++ b/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 diff --git a/cmd/dlv/main.go b/cmd/dlv/main.go index 2114fd30..7bf47122 100644 --- a/cmd/dlv/main.go +++ b/cmd/dlv/main.go @@ -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)