Skip to content

Commit

Permalink
pass version
Browse files Browse the repository at this point in the history
  • Loading branch information
kmuto committed Nov 5, 2023
1 parent a496452 commit aa3a70d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ builds:
- arm64
ldflags:
- -s -w
- -X main.version={{ .Version }}
- -X main.revision={{ .ShortCommit }}

archives:
- format: zip
Expand Down
7 changes: 7 additions & 0 deletions checkmackerelmetric/checkmackerelmetric.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ type mackerelMetricOpts struct {
Critical uint `arg:"-c,--critical,required" help:"minute to be CRITICAL (MINUTE: 1-1441)" placeholder:"MINUTE"`
}

var version string
var revision string

func (mackerelMetricOpts) Version() string {
return fmt.Sprintf("Version %s (rev.%s)", version, revision)
}

func Do() {
opts, err := parseArgs(os.Args[1:])
if err != nil {
Expand Down

0 comments on commit aa3a70d

Please sign in to comment.