From 56f4e5521a614473c43abad70d33983f319c072e Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Wed, 13 Nov 2019 18:19:56 +0300 Subject: [PATCH] CHANGE: naming adjustents + make release --- Makefile | 4 ++++ cmd/gk/main.go | 16 +++++++--------- pkg/version/version.go | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 06a5507..90e8816 100644 --- a/Makefile +++ b/Makefile @@ -19,3 +19,7 @@ test: build: GO111MODULE=on CGO_ENABLED=0 go build -ldflags "-s -w -X github.com/imorph/gate-keeper/pkg/version.REVISION=$(GIT_COMMIT) -X github.com/imorph/gate-keeper/pkg/version.APPNAME=$(NAME)" -a -o ./bin/gk ./cmd/gk/* # GO111MODULE=on GIT_COMMIT=$(git rev-list -1 HEAD) && GO111MODULE=on CGO_ENABLED=0 go build -ldflags "-s -w -X github.com/imorph/gate-keeper/pkg/version.REVISION=$(GIT_COMMIT) -X github.com/imorph/gate-keeper/pkg/version.APPNAME=$(CLI_NAME)" -a -o ./bin/gkcli ./cmd/gkcli/* + +release: + git tag $(VERSION) + git push origin $(VERSION) \ No newline at end of file diff --git a/cmd/gk/main.go b/cmd/gk/main.go index 15a4a23..545c4ab 100644 --- a/cmd/gk/main.go +++ b/cmd/gk/main.go @@ -25,15 +25,13 @@ func run() error { startTime := time.Now() var cfg struct { - Srv struct { - APIhost string `conf:"default:127.0.0.1:10001"` - LogLevel string `conf:"default:info"` - } + ListenHost string `conf:"default:127.0.0.1:10001"` + LogLevel string `conf:"default:info"` } - if err := conf.Parse(os.Args[1:], "GATE-KEEPER", &cfg); err != nil { + if err := conf.Parse(os.Args[1:], "GK", &cfg); err != nil { if err == conf.ErrHelpWanted { - usage, err := conf.Usage("GATE-KEEPER", &cfg) + usage, err := conf.Usage("GK", &cfg) if err != nil { return errors.Wrap(err, "generating config usage") } @@ -44,7 +42,7 @@ func run() error { } // configure logging - logger, _ := initZap(cfg.Srv.LogLevel) + logger, _ := initZap(cfg.LogLevel) defer func() { err := logger.Sync() if err != nil { @@ -57,8 +55,8 @@ func run() error { logger.Info("Application started", zap.Duration("startup_duration", time.Since(startTime)), - zap.String("listen_address", cfg.Srv.APIhost), - zap.String("log_level", cfg.Srv.LogLevel), + zap.String("listen_address", cfg.ListenHost), + zap.String("log_level", cfg.LogLevel), zap.String("app_name", version.GetAppName()), zap.String("version", version.GetVersion()), zap.String("revision", version.GetRevision()), diff --git a/pkg/version/version.go b/pkg/version/version.go index 39b52b3..1512e5c 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -1,7 +1,7 @@ package version -var APPNAME = "gk" -var VERSION = "0.0.1" +var APPNAME = "unknown" +var VERSION = "v0.0.1" var REVISION = "unknown"