Add version

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
This commit is contained in:
Jianhui Zhao
2018-03-14 22:34:03 +08:00
parent fd80dbe988
commit 252e7601de
4 changed files with 36 additions and 0 deletions
+4
View File
@@ -31,6 +31,7 @@ import (
"encoding/json"
_ "github.com/zhaojh329/rttys/statik"
"github.com/rakyll/statik/fs"
"github.com/zhaojh329/rttys/version"
)
type DeviceInfo struct {
@@ -55,6 +56,9 @@ func main() {
rand.Seed(time.Now().Unix())
log.Println("BuildDate:", version.BuildDate)
log.Println("Gitref:", version.Gitref)
br := newBridge()
go br.run()
+20
View File
@@ -0,0 +1,20 @@
BUILDDATE=`date +%F`
GITREF=`git describe --always --tags --long`
# $(VERSION_GO) will be written to version.go
VERSION_GO="/* DO NOT EDIT THIS FILE. IT IS GENERATED BY 'make'*/\n\
package version\n\
var Gitref, BuildDate string\n"
# $(GIT_GO) will be written to gitref.go
GITREF_GO="/* DO NOT EDIT THIS FILE. IT IS GENERATED BY make */ \n\n\
package version\n\
func init() { Gitref = \"$(GITREF)\"\nBuildDate= \"$(BUILDDATE)\"\n} "
#
# setver updates version.go with VERSION
#
.PHONY:setver
setver:
@printf $(VERSION_GO) | gofmt > version.go
@printf $(GITREF_GO) | gofmt > git.go
+8
View File
@@ -0,0 +1,8 @@
/* DO NOT EDIT THIS FILE. IT IS GENERATED BY make */
package version
func init() {
Gitref = "0079594-dirty"
BuildDate = "2018-03-14"
}
+4
View File
@@ -0,0 +1,4 @@
/* DO NOT EDIT THIS FILE. IT IS GENERATED BY 'make'*/
package version
var Gitref, BuildDate string