Skip to content

Commit

Permalink
yet another attempt to inject version
Browse files Browse the repository at this point in the history
  • Loading branch information
kucukaslan committed Sep 30, 2023
1 parent be49f11 commit 97a1bc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 0 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
before:
hooks:
- go build -ldflags "-s -w -X main.Version={{.Tag}} -X main.GitCommit={{ .ShortCommit }}"
builds:
-
binary: todo
ldflags: -s -w -X main.Version={{.Tag}} -X main.GitCommit={{ .ShortCommit }}
env:
- CGO_ENABLED=0
goos:
Expand Down
10 changes: 6 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ import (

var (
// Version represents the git tag of a particular release.
Version = "v0.0.0"
version = "v0.0.0"

// GitCommit represents git commit hash of a particular release.
GitCommit = "dev"
commit = "dev"
date = ""
builtBy = ""
)

func main() {
Expand Down Expand Up @@ -71,7 +73,7 @@ func main() {
}

func printVersion() {
v := Version + "-" + GitCommit
fmt.Println("todo ", v, " (by Muhammed Can Küçükaslan https://github.com/kucukaslan)\nYou're currently using the version ", v)
v := version + "-" + commit
fmt.Println("todo ", v, " built on", date," (by Muhammed Can Küçükaslan https://github.com/kucukaslan)")
fmt.Println("There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.")
}

0 comments on commit 97a1bc5

Please sign in to comment.