diff options
| author | Jeff Carr <[email protected]> | 2024-11-15 10:51:45 -0600 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-15 10:51:45 -0600 | 
| commit | ff564380a71b607821de4eca4afa0865f3c7e51c (patch) | |
| tree | 860fc04af74d5d95ae8321baf327a9e1ec6d412e | |
| parent | 2101ed1ae966834cd1d22d2e6ea1aff990e4a2e9 (diff) | |
fix ldflagsv0.22.9
| -rw-r--r-- | Makefile | 5 | ||||
| -rw-r--r-- | argv.go | 2 | ||||
| -rw-r--r-- | buildPackage.go | 15 | ||||
| -rw-r--r-- | main.go | 3 | 
4 files changed, 15 insertions, 10 deletions
@@ -1,6 +1,7 @@  .PHONY: debian  VERSION = $(shell git describe --tags) +DATE = $(shell date +%Y.%m.%d)  run: build  	./go-deb --repo go.wit.com/apps/autotypist @@ -17,11 +18,11 @@ build:  	touch resources/blank.so  	-cp -a ~/go/src/go.wit.com/toolkits/*.so resources/ # embed the toolkit plugins  	GO111MODULE="off" go build -v \ -		    -ldflags "-X main.VERSION=${VERSION} -X gui.GUIVERSION=${VERSION}" +		    -ldflags "-X main.VERSION=${VERSION} -X main.DATE=${DATE} -X gui.GUIVERSION=${VERSION}"  install:  	GO111MODULE="off" go install -v \ -		    -ldflags "-X main.VERSION=${VERSION} -X gui.GUIVERSION=${VERSION}" +		    -ldflags "-X main.VERSION=${VERSION} -X main.DATE=${DATE} -X gui.GUIVERSION=${VERSION}"  goimports:  	goimports -w *.go @@ -34,5 +34,5 @@ func init() {  }  func (args) Version() string { -	return "go-clone " + VERSION +	return "go-clone " + VERSION + "    Built on " + DATE  } diff --git a/buildPackage.go b/buildPackage.go index 498662e..8d3bba2 100644 --- a/buildPackage.go +++ b/buildPackage.go @@ -72,14 +72,19 @@ func (c *controlBox) buildPackage() (bool, error) {  		os.Setenv("GO111MODULE", "off")  		cmd := []string{"go", "build", "-v", "-x"} +		// set standard ldflag options +		now := time.Now() +		datestamp := now.UTC().Format("2006/01/02_1504_UTC") +		log.Info("datestamp =", datestamp)  		// add some standard golang flags -		vldflag := "-X main.VERSION=" + version -		gldflag := "-X main.GUIVERSION=" + version // todo: git this from the filesystem -		// timeflag := "-X main.BUILDTIME='${BUILDTIME}'" -		cmd = append(cmd, "-ldflags", vldflag) -		cmd = append(cmd, "-ldflags", gldflag) +		ldflags := "-X main.VERSION=" + version + " " +		ldflags += "-X main.BUILDTIME=" + datestamp + " " +		ldflags += "-X main.GUIVERSION=" + version + "" // todo: git this from the filesystem +		cmd = append(cmd, "-ldflags", ldflags)  		// add any flags from the command line +		// this might not actually work +		// todo: test this  		for _, flag := range argv.Ldflags {  			cmd = append(cmd, "-ldflags", "-X "+flag)  		} @@ -14,6 +14,7 @@ import (  // sent from -ldflags  var VERSION string +var DATE string  // This is the beginning of the binary tree of GUI widgets  var myGui *gui.Node @@ -27,8 +28,6 @@ var basicWindow *gadgets.BasicWindow  var resources embed.FS  func main() { -	// RunTest() -	// os.Exit(0)  	if argv.Repo == "" {  		log.Info("You need to tell me what repo you want to work on")  		println("")  | 
