add Makefile
This commit is contained in:
parent
2ef9930f8d
commit
f9733e10d7
|
@ -0,0 +1,17 @@
|
|||
.PHONY: start build
|
||||
|
||||
APP = categraf
|
||||
VER = 0.1.0
|
||||
|
||||
all: build
|
||||
|
||||
build:
|
||||
go build -ldflags "-w -s -X flashcat.cloud/categraf/config.Version=$(VER)"
|
||||
|
||||
pack:
|
||||
env GOOS=linux GOARCH=amd64 go build -ldflags "-w -s -X flashcat.cloud/categraf/config.VERSION=$(VER)"
|
||||
env GOOS=windows GOARCH=amd64 go build -ldflags "-w -s -X flashcat.cloud/categraf/config.VERSION=$(VER)"
|
||||
rm -rf $(APP)-$(VER).tar.gz
|
||||
rm -rf $(APP)-$(VER).zip
|
||||
tar -zcvf $(APP)-$(VER).tar.gz conf $(APP)
|
||||
zip -r $(APP)-$(VER).zip conf $(APP).exe
|
|
@ -0,0 +1,3 @@
|
|||
package config
|
||||
|
||||
var Version = "unknown"
|
3
main.go
3
main.go
|
@ -21,7 +21,6 @@ import (
|
|||
|
||||
var (
|
||||
appPath string
|
||||
version = "0.1.0"
|
||||
configDir = flag.String("configs", osx.GetEnv("CATEGRAF_CONFIGS", "conf"), "Specify configuration directory.(env:CATEGRAF_CONFIGS)")
|
||||
debugMode = flag.Bool("debug", false, "Is debug mode?")
|
||||
testMode = flag.Bool("test", false, "Is test mode? print metrics to stdout")
|
||||
|
@ -51,7 +50,7 @@ func main() {
|
|||
flag.Parse()
|
||||
|
||||
if *showVersion {
|
||||
fmt.Println(version)
|
||||
fmt.Println(config.Version)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue