From 8204a45434b19f967ae738433295742ea5a7d191 Mon Sep 17 00:00:00 2001 From: Adam Shannon Date: Tue, 8 Oct 2019 17:23:11 -0500 Subject: [PATCH] build: move Version const to root package --- cmd/server/main.go | 6 +++--- makefile | 2 +- pkg/achclient/client.go | 4 ++-- internal/version/version.go => version.go | 5 +++-- 4 files changed, 9 insertions(+), 8 deletions(-) rename internal/version/version.go => version.go (70%) diff --git a/cmd/server/main.go b/cmd/server/main.go index 17f838cf3..3a9b44a7a 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -19,6 +19,7 @@ import ( "github.com/moov-io/base/admin" "github.com/moov-io/base/http/bind" + "github.com/moov-io/paygate" "github.com/moov-io/paygate/internal" "github.com/moov-io/paygate/internal/database" "github.com/moov-io/paygate/internal/fed" @@ -26,7 +27,6 @@ import ( "github.com/moov-io/paygate/internal/microdeposit" "github.com/moov-io/paygate/internal/ofac" "github.com/moov-io/paygate/internal/util" - "github.com/moov-io/paygate/internal/version" "github.com/moov-io/paygate/pkg/achclient" "github.com/go-kit/kit/log" @@ -55,7 +55,7 @@ func main() { logger = log.With(logger, "ts", log.DefaultTimestampUTC) logger = log.With(logger, "caller", log.DefaultCaller) - logger.Log("startup", fmt.Sprintf("Starting paygate server version %s", version.Version)) + logger.Log("startup", fmt.Sprintf("Starting paygate server version %s", paygate.Version)) // migrate database db, err := database.New(logger, os.Getenv("DATABASE_TYPE")) @@ -81,7 +81,7 @@ func main() { *adminAddr = v } adminServer := admin.NewServer(*adminAddr) - adminServer.AddVersionHandler(version.Version) // Setup 'GET /version' + adminServer.AddVersionHandler(paygate.Version) // Setup 'GET /version' go func() { logger.Log("admin", fmt.Sprintf("listening on %s", adminServer.BindAddr())) if err := adminServer.Listen(); err != nil { diff --git a/makefile b/makefile index 7ab2bb60b..e80436c3a 100644 --- a/makefile +++ b/makefile @@ -1,5 +1,5 @@ PLATFORM=$(shell uname -s | tr '[:upper:]' '[:lower:]') -VERSION := $(shell grep -Eo '(v[0-9]+[\.][0-9]+[\.][0-9]+(-[a-zA-Z0-9]*)?)' internal/version/version.go) +VERSION := $(shell grep -Eo '(v[0-9]+[\.][0-9]+[\.][0-9]+(-[a-zA-Z0-9]*)?)' version.go) .PHONY: build docker release diff --git a/pkg/achclient/client.go b/pkg/achclient/client.go index 0fb80ccff..715f4ca30 100644 --- a/pkg/achclient/client.go +++ b/pkg/achclient/client.go @@ -18,7 +18,7 @@ import ( "time" "github.com/moov-io/base/http/bind" - "github.com/moov-io/paygate/internal/version" + "github.com/moov-io/paygate" "github.com/go-kit/kit/log" ) @@ -115,7 +115,7 @@ func createRequestId() string { } func (a *ACH) addRequestHeaders(idempotencyKey, requestID string, r *http.Request) { - r.Header.Set("User-Agent", fmt.Sprintf("ach/%s", version.Version)) + r.Header.Set("User-Agent", fmt.Sprintf("ach/%s", paygate.Version)) if idempotencyKey != "" { r.Header.Set("X-Idempotency-Key", idempotencyKey) } diff --git a/internal/version/version.go b/version.go similarity index 70% rename from internal/version/version.go rename to version.go index 7f5f1413c..8a46229cd 100644 --- a/internal/version/version.go +++ b/version.go @@ -2,6 +2,7 @@ // Use of this source code is governed by an Apache License // license that can be found in the LICENSE file. -package version +package paygate -const Version = "v0.7.0-rc1" +// Version number +const Version = "v0.7.0-rc2"