From 9b4fce5ebef905fad4f77f3d509503962dc47c11 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Mon, 18 Mar 2024 11:15:45 -0500 Subject: [PATCH] change var name --- Makefile | 4 ++-- build/docker/Dockerfile | 2 +- internal/rest-client/flasharray_client.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ffb9640..b2e6e7c 100644 --- a/Makefile +++ b/Makefile @@ -26,11 +26,11 @@ init: build: ## Build project and put the output binary in out/bin/ mkdir -p out/bin - CGO_ENABLED=0 GO111MODULE=on $(GOCMD) build -a -mod=readonly -tags 'netgo osusergo static_build' -ldflags="-X 'main.version=v$(VERSION)' -X 'purestorage/fa-openmetrics-exporter/internal/rest-client.version=$(VERSION)'" -o out/bin/$(BINARY_NAME) cmd/fa-om-exporter/main.go + CGO_ENABLED=0 GO111MODULE=on $(GOCMD) build -a -mod=readonly -tags 'netgo osusergo static_build' -ldflags="-X 'main.version=v$(VERSION)' -X 'purestorage/fa-openmetrics-exporter/internal/rest-client.UserAgentVersion=$(VERSION)'" -o out/bin/$(BINARY_NAME) cmd/fa-om-exporter/main.go build-with-vendor: ## Build project using the vendor directory and put the output binary in out/bin/ mkdir -p out/bin - CGO_ENABLED=0 GO111MODULE=on $(GOCMD) build -a -mod=vendor -tags 'netgo osusergo static_build' -ldflags="-X 'main.version=v$(VERSION)' -X 'purestorage/fa-openmetrics-exporter/internal/rest-client.version=$(VERSION)'" -o out/bin/$(BINARY_NAME) cmd/fa-om-exporter/main.go + CGO_ENABLED=0 GO111MODULE=on $(GOCMD) build -a -mod=vendor -tags 'netgo osusergo static_build' -ldflags="-X 'main.version=v$(VERSION)' -X 'purestorage/fa-openmetrics-exporter/internal/rest-client.UserAgentVersion=$(VERSION)'" -o out/bin/$(BINARY_NAME) cmd/fa-om-exporter/main.go clean: ## Remove build related file rm -fr ./bin diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 813a429..0e933f1 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -9,7 +9,7 @@ RUN go mod download && go mod verify COPY . . -RUN CGO_ENABLED=1 go build -mod=readonly -a -tags 'netgo osusergo static_build' -ldflags="-X 'main.version=v$VERSION' -X 'purestorage/fa-openmetrics-exporter/internal/rest-client.version=$VERSION'" -v -o /usr/local/bin/pure-fa-om-exporter cmd/fa-om-exporter/main.go +RUN CGO_ENABLED=1 go build -mod=readonly -a -tags 'netgo osusergo static_build' -ldflags="-X 'main.version=v$VERSION' -X 'purestorage/fa-openmetrics-exporter/internal/rest-client.UserAgentVersion=$VERSION'" -v -o /usr/local/bin/pure-fa-om-exporter cmd/fa-om-exporter/main.go # alpine is used here as it seems to be the minimal image that passes quay.io vulnerability scan diff --git a/internal/rest-client/flasharray_client.go b/internal/rest-client/flasharray_client.go index a41e8a0..ea3baf9 100644 --- a/internal/rest-client/flasharray_client.go +++ b/internal/rest-client/flasharray_client.go @@ -7,9 +7,9 @@ import ( "github.com/go-resty/resty/v2" ) -var version string = "development" +var UserAgentVersion string = "development" -var FARestUserAgent string = "Pure_FA_OpenMetrics_exporter/" + version +var FARestUserAgent string = "Pure_FA_OpenMetrics_exporter/" + UserAgentVersion type Client interface { GetAlerts(filter string) *AlertsList