update version code 更新版本号

pull/132/head
macbookpro 6 years ago
parent 2d156502a1
commit c02f2af4fe

@ -17,6 +17,11 @@ import (
"github.com/penggy/service" "github.com/penggy/service"
) )
var (
gitCommitCode string
buildDateTime string
)
type program struct { type program struct {
httpPort int httpPort int
httpServer *http.Server httpServer *http.Server
@ -128,13 +133,20 @@ func main() {
flag.StringVar(&utils.FlagVarConfFile, "config", "", "configure file path") flag.StringVar(&utils.FlagVarConfFile, "config", "", "configure file path")
flag.Parse() flag.Parse()
tail := flag.Args() tail := flag.Args()
// log // log
log.SetPrefix("[EasyDarwin] ") log.SetPrefix("[EasyDarwin] ")
log.SetFlags(log.Lshortfile | log.LstdFlags) log.SetFlags(log.Lshortfile | log.LstdFlags)
if !utils.Debug { if !utils.Debug {
log.Println("log files -->", utils.LogDir()) log.Println("log files -->", utils.LogDir())
log.Printf("git commit code:%s", gitCommitCode)
log.Printf("build date:%s", buildDateTime)
log.SetOutput(utils.GetLogWriter()) log.SetOutput(utils.GetLogWriter())
} }
log.Printf("git commit code:%s", gitCommitCode)
log.Printf("build date:%s", buildDateTime)
routers.BuildVersion = fmt.Sprintf("%s.%s", routers.BuildVersion, gitCommitCode)
routers.BuildDateTime = buildDateTime
sec := utils.Conf().Section("service") sec := utils.Conf().Section("service")
svcConfig := &service.Config{ svcConfig := &service.Config{

@ -7,9 +7,9 @@
"build:ico": "rsrc -arch amd64 -ico ed.ico -o EasyDarwin_windows.syso", "build:ico": "rsrc -arch amd64 -ico ed.ico -o EasyDarwin_windows.syso",
"build:www": "cd web_src && npm run build && cd .. && apidoc -i routers -o www/apidoc", "build:www": "cd web_src && npm run build && cd .. && apidoc -i routers -o www/apidoc",
"build:doc": "apidoc -i routers -o www/apidoc", "build:doc": "apidoc -i routers -o www/apidoc",
"build:win": "go build -tags release -ldflags \"-s -w\" -o EasyDarwin.exe", "build:win": "go build -tags release -ldflags \"-X 'main.buildDateTime=$(date '+%Y-%m-%d %H:%M:%S')' -X 'main.gitCommitCode=$(git rev-list --full-history --all --abbrev-commit --max-count 1)' -s -w\" -o EasyDarwin.exe",
"build:lin": "go build -tags release -ldflags \"-s -w\" -o easydarwin", "build:lin": "go build -tags release -ldflags \"-X 'main.buildDateTime=$(date '+%Y-%m-%d %H:%M:%S')' -X 'main.gitCommitCode=$(git rev-list --full-history --all --abbrev-commit --max-count 1)' -s -w\" -o easydarwin",
"build:dev": "go build -o EasyDarwin.exe", "build:dev": "go build -ldflags \"-X 'main.buildDateTime=$(date '+%Y-%m-%d %H:%M:%S')' -X 'main.gitCommitCode=$(git rev-list --full-history --all --abbrev-commit --max-count 1)'\" -o EasyDarwin.exe",
"dev": "gobuild -o EasyDarwin.exe", "dev": "gobuild -o EasyDarwin.exe",
"dev:lin": "gobuild -o easydarwin", "dev:lin": "gobuild -o easydarwin",
"dev:www": "cd web_src && npm run start", "dev:www": "cd web_src && npm run start",
@ -65,5 +65,5 @@
] ]
} }
} }
] ]
} }

@ -113,7 +113,7 @@ func (h *APIHandler) GetServerInfo(c *gin.Context) {
"InterfaceVersion": "V1", "InterfaceVersion": "V1",
"RunningTime": utils.UpTimeString(), "RunningTime": utils.UpTimeString(),
"StartUpTime": utils.DateTime(utils.StartTime), "StartUpTime": utils.DateTime(utils.StartTime),
"Server": fmt.Sprintf("%s/%s (Platform/%s;)", "EasyDarwin", BuildVersion, strings.Title(runtime.GOOS)), "Server": fmt.Sprintf("%s/%s,%s (Platform/%s;)", "EasyDarwin", BuildDateTime, BuildVersion, strings.Title(runtime.GOOS)),
"memData": memData, "memData": memData,
"cpuData": cpuData, "cpuData": cpuData,
"pusherData": pusherData, "pusherData": pusherData,

@ -2,9 +2,8 @@ package routers
import "github.com/penggy/EasyGoLib/utils" import "github.com/penggy/EasyGoLib/utils"
const ( var BuildVersion = "v8.1"
BuildVersion = "v8.1" var BuildDateTime = ""
)
type PercentData struct { type PercentData struct {
Time utils.DateTime `json:"time"` Time utils.DateTime `json:"time"`

Loading…
Cancel
Save