From 91314e85da483106c3e0c4b15cd1e444ebf70b87 Mon Sep 17 00:00:00 2001 From: JocularMarrow Date: Tue, 18 Jun 2024 12:33:43 +0200 Subject: [PATCH] removed version command --- .github/workflows/release.yml | 2 +- internal/cmd/version.go | 24 ------------------------ internal/version/version.go | 24 ------------------------ 3 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 internal/cmd/version.go delete mode 100644 internal/version/version.go diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cb13031..d5fa153 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: mkdir -p bin GOVERSION=$(go version | awk '{print $3}') VERSION=${GITHUB_REF#refs/tags/v} - GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o bin/hashit_${{ matrix.goos }}_${{ matrix.goarch }}$([[ ${{ matrix.goos }} == 'windows' ]] && echo .exe || echo '') -ldflags "-X 'github.com/TechMDW/hashit/internal/version.Version=$VERSION' -X 'github.com/TechMDW/hashit/internal/version.GoBuildVersion=$GOVERSION'" ./main.go + GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o bin/hashit_${{ matrix.goos }}_${{ matrix.goarch }}$([[ ${{ matrix.goos }} == 'windows' ]] && echo .exe || echo '') ./main.go - name: List files for debug run: ls -la bin diff --git a/internal/cmd/version.go b/internal/cmd/version.go deleted file mode 100644 index 5113806..0000000 --- a/internal/cmd/version.go +++ /dev/null @@ -1,24 +0,0 @@ -package cmd - -import ( - "fmt" - - "github.com/TechMDW/hashit/internal/version" - "github.com/spf13/cobra" -) - -var VersionCmd = &cobra.Command{ - Use: "version", - Short: "Print the version number of hashit", - Long: `Print the version number of hashit.`, - Run: versionRun, -} - -func versionRun(cmd *cobra.Command, args []string) { - cmd.Println(fmt.Sprintf("hashit version: %s", version.Version)) - cmd.Println(fmt.Sprintf("Go version: %s", version.GoVersion)) -} - -func init() { - rootCmd.AddCommand(VersionCmd) -} diff --git a/internal/version/version.go b/internal/version/version.go deleted file mode 100644 index c483c1d..0000000 --- a/internal/version/version.go +++ /dev/null @@ -1,24 +0,0 @@ -package version - -import ( - "strings" -) - -var Version string -var GoVersion string - -func init() { - // If the version is not set, assume it is a development build - if Version == "" { - Version = "development" - return - } - - // Remove the leading "v" if it exists - if Version[0] == 'v' { - Version = Version[1:] - } - - // Remove the leading "go" if it exists - GoVersion = strings.TrimLeft(GoVersion, "go") -}