Skip to content

Commit

Permalink
Fix: terratag --version command is broken (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomerHeber authored Apr 4, 2023
1 parent ab5b4d1 commit a0d15cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Build project
run: |
mkdir out
CGO_ENABLED=0 go build -a -installsuffix cgo -o ./out/terratag/terratag ./cmd/terratag
CGO_ENABLED=0 go build -ldflags "-X main.version=${{github.ref_name}}" -a -installsuffix cgo -o ./out/terratag/terratag ./cmd/terratag
# Setup .npmrc file to publish to GitHub Packages
- name: Setup Node
Expand Down
7 changes: 6 additions & 1 deletion cmd/terratag/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"log"
"os"
"strings"

"github.com/env0/terratag"
"github.com/env0/terratag/cli"
Expand All @@ -22,7 +23,11 @@ func main() {
}

if args.Version {
fmt.Printf("Terratag v%s\n", version)
var versionPrefix string
if !strings.HasPrefix(version, "v") {
versionPrefix = "v"
}
fmt.Printf("Terratag %s%s\n", versionPrefix, version)
return
}

Expand Down

0 comments on commit a0d15cf

Please sign in to comment.