Skip to content

Commit

Permalink
Merge pull request #40 from evilmarty/commit
Browse files Browse the repository at this point in the history
Include commit tag in version output
  • Loading branch information
evilmarty authored Jul 5, 2024
2 parents 9e6b1e3 + 16fc299 commit b02a7c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ builds:
- "6"
- "7"
ldflags:
- "-s -w -X main.BuildDate={{ .Date }} -X main.Version={{ .Version }}"
- "-s -w -X main.BuildDate={{ .Date }} -X main.Version={{ .Version }} -X main.Commit={{.Commit}}"
archives:
- name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
format: binary
brews:
- directory: Formula
homepage: "https://github.com/evilmarty/ilc"
description: "A simple way to create a command-line utility."
license: "GPL-3.0"
description: "Simplify creating command-line utilities"
license: "GPL"
install: |
bin.install Dir["*"].first => "ilc"
test: |
Expand Down
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
var (
Version = "No version provided"
BuildDate = "Unknown build date"
Commit = ""
mainFlagSet = flag.NewFlagSet("ILC", flag.ExitOnError)
logger = log.New(io.Discard, "DEBUG: ", log.Lshortfile)
)
Expand All @@ -25,6 +26,9 @@ func main() {
}
mainFlagSet.BoolFunc("version", "Displays the version", func(_ string) error {
fmt.Printf("ILC - %s\nVersion: %s\n", BuildDate, Version)
if Commit != "" {
fmt.Printf("Commit: %s\n", Commit)
}
os.Exit(0)
return nil
})
Expand Down

0 comments on commit b02a7c2

Please sign in to comment.