add build date. backup go.work file
This commit is contained in:
parent
f8bef3081c
commit
afb478c8c7
5
Makefile
5
Makefile
|
@ -1,4 +1,5 @@
|
|||
VERSION = $(shell git describe --tags)
|
||||
DATE = $(shell date +%Y.%m.%d)
|
||||
|
||||
run: build
|
||||
@#./go-clone --work github.com/rclone/rclone
|
||||
|
@ -24,7 +25,7 @@ no-gui: build
|
|||
|
||||
build:
|
||||
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}"
|
||||
|
||||
build-go-1.21:
|
||||
@#GO111MODULE=off /usr/lib/go-1.21/bin/go build -v -ldflags "-X main.VERSION=${VERSION}"
|
||||
|
@ -33,7 +34,7 @@ build-go-1.21:
|
|||
|
||||
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
|
||||
|
|
2
argv.go
2
argv.go
|
@ -32,5 +32,5 @@ This will recursively clone the app and all the build requirements:
|
|||
}
|
||||
|
||||
func (args) Version() string {
|
||||
return "go-clone " + VERSION
|
||||
return "go-clone " + VERSION + " " + DATE
|
||||
}
|
||||
|
|
9
main.go
9
main.go
|
@ -16,6 +16,7 @@ import (
|
|||
|
||||
// sent via -ldflags
|
||||
var VERSION string
|
||||
var DATE string
|
||||
|
||||
var rv *repolist.RepoList
|
||||
|
||||
|
@ -133,9 +134,15 @@ func main() {
|
|||
log.Info("Total repositories:", count)
|
||||
log.Info("Finished go-clone for", argv.Repo)
|
||||
if argv.AutoWork {
|
||||
log.Info("Creating", wdir+"/go.work")
|
||||
log.Info("About to re-create", wdir+"/go.work")
|
||||
log.Info("Sleep 3. original go.work saved as go.work.last (hit ctrl-c to cancel)")
|
||||
log.Sleep(3)
|
||||
shell.PathRun(wdir, []string{"mv", "go.work", "go.work.last"})
|
||||
rv.MakeGoWork()
|
||||
shell.PathRun(wdir, []string{"go", "work", "use"})
|
||||
log.Info("")
|
||||
log.Info("original go.work file saved as go.work.last")
|
||||
log.Info("")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue