fix ldflags
This commit is contained in:
parent
2101ed1ae9
commit
ff564380a7
5
Makefile
5
Makefile
|
@ -1,6 +1,7 @@
|
||||||
.PHONY: debian
|
.PHONY: debian
|
||||||
|
|
||||||
VERSION = $(shell git describe --tags)
|
VERSION = $(shell git describe --tags)
|
||||||
|
DATE = $(shell date +%Y.%m.%d)
|
||||||
|
|
||||||
run: build
|
run: build
|
||||||
./go-deb --repo go.wit.com/apps/autotypist
|
./go-deb --repo go.wit.com/apps/autotypist
|
||||||
|
@ -17,11 +18,11 @@ build:
|
||||||
touch resources/blank.so
|
touch resources/blank.so
|
||||||
-cp -a ~/go/src/go.wit.com/toolkits/*.so resources/ # embed the toolkit plugins
|
-cp -a ~/go/src/go.wit.com/toolkits/*.so resources/ # embed the toolkit plugins
|
||||||
GO111MODULE="off" go build -v \
|
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:
|
install:
|
||||||
GO111MODULE="off" go install -v \
|
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:
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
|
|
2
argv.go
2
argv.go
|
@ -34,5 +34,5 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (args) Version() string {
|
func (args) Version() string {
|
||||||
return "go-clone " + VERSION
|
return "go-clone " + VERSION + " Built on " + DATE
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,14 +72,19 @@ func (c *controlBox) buildPackage() (bool, error) {
|
||||||
os.Setenv("GO111MODULE", "off")
|
os.Setenv("GO111MODULE", "off")
|
||||||
cmd := []string{"go", "build", "-v", "-x"}
|
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
|
// add some standard golang flags
|
||||||
vldflag := "-X main.VERSION=" + version
|
ldflags := "-X main.VERSION=" + version + " "
|
||||||
gldflag := "-X main.GUIVERSION=" + version // todo: git this from the filesystem
|
ldflags += "-X main.BUILDTIME=" + datestamp + " "
|
||||||
// timeflag := "-X main.BUILDTIME='${BUILDTIME}'"
|
ldflags += "-X main.GUIVERSION=" + version + "" // todo: git this from the filesystem
|
||||||
cmd = append(cmd, "-ldflags", vldflag)
|
cmd = append(cmd, "-ldflags", ldflags)
|
||||||
cmd = append(cmd, "-ldflags", gldflag)
|
|
||||||
|
|
||||||
// add any flags from the command line
|
// add any flags from the command line
|
||||||
|
// this might not actually work
|
||||||
|
// todo: test this
|
||||||
for _, flag := range argv.Ldflags {
|
for _, flag := range argv.Ldflags {
|
||||||
cmd = append(cmd, "-ldflags", "-X "+flag)
|
cmd = append(cmd, "-ldflags", "-X "+flag)
|
||||||
}
|
}
|
||||||
|
|
3
main.go
3
main.go
|
@ -14,6 +14,7 @@ import (
|
||||||
|
|
||||||
// sent from -ldflags
|
// sent from -ldflags
|
||||||
var VERSION string
|
var VERSION string
|
||||||
|
var DATE string
|
||||||
|
|
||||||
// This is the beginning of the binary tree of GUI widgets
|
// This is the beginning of the binary tree of GUI widgets
|
||||||
var myGui *gui.Node
|
var myGui *gui.Node
|
||||||
|
@ -27,8 +28,6 @@ var basicWindow *gadgets.BasicWindow
|
||||||
var resources embed.FS
|
var resources embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// RunTest()
|
|
||||||
// os.Exit(0)
|
|
||||||
if argv.Repo == "" {
|
if argv.Repo == "" {
|
||||||
log.Info("You need to tell me what repo you want to work on")
|
log.Info("You need to tell me what repo you want to work on")
|
||||||
println("")
|
println("")
|
||||||
|
|
Loading…
Reference in New Issue