From 566fe286e6bc9a09d5eb3f2bd63fcecd89b0f5be Mon Sep 17 00:00:00 2001 From: Chris Ondrovic Date: Mon, 9 Sep 2024 13:01:49 -0400 Subject: [PATCH] Bugfixes Fixed version and build flags Fixed goreleaser version --- Makefile | 4 ++-- cmd/root.go | 6 +++--- main.go => folder-structure-cli.go | 0 goreleaser.yaml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) rename main.go => folder-structure-cli.go (100%) diff --git a/Makefile b/Makefile index 94c8e7b..02648a1 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ export GO111MODULE=on GOOS := $(shell go env GOOS) VERSION := $(shell git describe --tags --always) -BUILD_FLAGS := -ldflags="-X 'main.version=$(VERSION)'" +BUILD_FLAGS := -ldflags="-X 'github.com/ondrovic/folder-structure-cli/cmd.Version=$(VERSION)'" # update to main app path -APP_PATH := main.go +APP_PATH := folder-structure-cli.go # determins the variables based on GOOS ifeq ($(GOOS), windows) diff --git a/cmd/root.go b/cmd/root.go index efda213..a355ed5 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -6,15 +6,15 @@ import ( ) var ( - version *string + Version string ) func checkVersion() string { - if version == nil { + if Version == "" { return "0.0.0" } - return *version + return Version } var RootCmd = &cobra.Command{ diff --git a/main.go b/folder-structure-cli.go similarity index 100% rename from main.go rename to folder-structure-cli.go diff --git a/goreleaser.yaml b/goreleaser.yaml index 606c2a5..41ffdb9 100644 --- a/goreleaser.yaml +++ b/goreleaser.yaml @@ -3,8 +3,8 @@ version: 2 project_name: folder-structure-cli env: - - GO_MAIN_PATH=main.go - - VERSION_PATH=folder-structure-cli/cmd/root.version + - GO_MAIN_PATH=folder-structure-cli.go + - VERSION_PATH=github.com/ondrovic/folder-structure-cli/cmd.Version before: