diff --git a/config/global.go b/config/global.go index 93de3da..48ff91d 100755 --- a/config/global.go +++ b/config/global.go @@ -18,12 +18,12 @@ import ( // 服务名 const ( - Vendor = "CAOHONGJU" - Name = "ipchub" - Version = "V1.1.0" + Vendor = "CAOHONGJU" + Name = "ipchub" ) var ( + Version = "0" globalC *config consoleAppDir string demosAppDir string diff --git a/makefile b/makefile index 0b09a2a..7e44028 100755 --- a/makefile +++ b/makefile @@ -6,47 +6,55 @@ GOTEST=$(GOCMD) test GOGET=$(GOCMD) get ENABLED_CGO=0 BINARY_NAME=ipchub -BINARY_DIR= bin/v1.1.0 +VERSION=1.1.0 +BINARY_DIR=bin/v$(VERSION) build: - CGO_ENABLED=$(ENABLED_CGO) $(GOBUILD) -o bin/$(BINARY_NAME) . + CGO_ENABLED=$(ENABLED_CGO) $(GOBUILD) -o bin/$(BINARY_NAME) -ldflags "-X github.com/cnotch/ipchub/config.Version=$(VERSION)" . cp -r demos bin/ cp -r docs bin/ + # linux compilation build-linux-amd64: - CGO_ENABLED=$(ENABLED_CGO) GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_DIR)/linux/amd64/$(BINARY_NAME)$(VERSION) . + CGO_ENABLED=$(ENABLED_CGO) GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_DIR)/linux/amd64/$(BINARY_NAME) -ldflags "-X github.com/cnotch/ipchub/config.Version=$(VERSION)" . cp -r demos $(BINARY_DIR)/linux/amd64/ cp -r docs $(BINARY_DIR)/linux/amd64/ build-linux-386: - CGO_ENABLED=$(ENABLED_CGO) GOOS=linux GOARCH=386 $(GOBUILD) -o $(BINARY_DIR)/linux/386/$(BINARY_NAME)$(VERSION) . + CGO_ENABLED=$(ENABLED_CGO) GOOS=linux GOARCH=386 $(GOBUILD) -o $(BINARY_DIR)/linux/386/$(BINARY_NAME) -ldflags "-X github.com/cnotch/ipchub/config.Version=$(VERSION)" . + cp -r demos $(BINARY_DIR)/linux/386/ + cp -r docs $(BINARY_DIR)/linux/386/ +build-linux-arm64: + CGO_ENABLED=$(ENABLED_CGO) GOOS=linux GOARCH=arm64 $(GOBUILD) -o $(BINARY_DIR)/linux/arm/$(BINARY_NAME) -ldflags "-X github.com/cnotch/ipchub/config.Version=$(VERSION)" . + cp -r demos $(BINARY_DIR)/linux/arm64/ + cp -r docs $(BINARY_DIR)/linux/arm64/ build-linux-arm: - CGO_ENABLED=$(ENABLED_CGO) GOOS=linux GOARCH=arm $(GOBUILD) -o $(BINARY_DIR)/linux/arm/$(BINARY_NAME)$(VERSION) . + CGO_ENABLED=$(ENABLED_CGO) GOOS=linux GOARCH=arm $(GOBUILD) -o $(BINARY_DIR)/linux/arm/$(BINARY_NAME) -ldflags "-X github.com/cnotch/ipchub/config.Version=$(VERSION)" . + cp -r demos $(BINARY_DIR)/linux/arm/ + cp -r docs $(BINARY_DIR)/linux/arm/ # window compilation build-windows-amd64: - CGO_ENABLED=$(ENABLED_CGO) GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(BINARY_DIR)/windows/amd64/$(BINARY_NAME)$(VERSION).exe . + CGO_ENABLED=$(ENABLED_CGO) GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(BINARY_DIR)/windows/amd64/$(BINARY_NAME).exe -ldflags "-X github.com/cnotch/ipchub/config.Version=$(VERSION)" . cp -r demos $(BINARY_DIR)/windows/amd64/ cp -r docs $(BINARY_DIR)/windows/amd64/ -build-windows-386: - CGO_ENABLED=$(ENABLED_CGO) GOOS=windows GOARCH=386 $(GOBUILD) -o $(BINARY_DIR)/windows/386/$(BINARY_NAME)$(VERSION).exe . # darwin compilation build-darwin-amd64: - CGO_ENABLED=$(ENABLED_CGO) GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(BINARY_DIR)/darwin/amd64/$(BINARY_NAME)$(VERSION) . + CGO_ENABLED=$(ENABLED_CGO) GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(BINARY_DIR)/darwin/amd64/$(BINARY_NAME) -ldflags "-X github.com/cnotch/ipchub/config.Version=$(VERSION)" . cp -r demos $(BINARY_DIR)/darwin/amd64/ cp -r docs $(BINARY_DIR)/darwin/amd64/ -build-darwin-386: - CGO_ENABLED=$(ENABLED_CGO) GOOS=darwin GOARCH=386 $(GOBUILD) -o $(BINARY_DIR)/darwin/386/$(BINARY_NAME)$(VERSION) . # amd64 all platform compilation build-amd64: build-linux-amd64 build-windows-amd64 build-darwin-amd64 # all -build-all: build-linux-amd64 build-windows-amd64 build-darwin-amd64 build-linux-386 build-windows-386 build-darwin-386 build-linux-arm +build-all: build-linux-amd64 build-windows-amd64 build-darwin-amd64 build-linux-386 build-linux-arm64 build-linux-arm test: $(GOTEST) -v ./... clean: $(GOCLEAN) rm -f bin/$(BINARY_NAME) + rm -rf bin/demos + rm -rf bin/docs rm -rf $(BINARY_DIR) \ No newline at end of file diff --git a/service/service.go b/service/service.go index 8af2cc6..21569af 100755 --- a/service/service.go +++ b/service/service.go @@ -119,7 +119,7 @@ func (s *Service) Listen() (err error) { } } - s.logger.Infof("service started(%s).", config.Version) + s.logger.Infof("service started(v%s).", config.Version) s.logger = xlog.L() // Block select {}