From 67009da4e250722836f90e205a978255f32b9bea Mon Sep 17 00:00:00 2001 From: Colin O'Dell Date: Fri, 31 Dec 2021 14:24:55 -0500 Subject: [PATCH] Include version number in build --- .goreleaser.yaml | 4 +++- main.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 9e4578d..8f2c520 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -28,7 +28,7 @@ builds: - goos: darwin goarch: 386 binary: '{{ .ProjectName }}' - ldflags: -s -w + ldflags: -s -w -X 'main.version={{ .Version }}' flags: - -trimpath @@ -67,6 +67,8 @@ brews: homepage: https://github.com/colinodell/go-check-ssl description: Simple command line utility to check the status of an SSL certificate license: MIT + test: | + system "#{bin}/check-ssl --version" install: |- bin.install "{{ .ProjectName }}" diff --git a/main.go b/main.go index de2def0..cb5ea74 100644 --- a/main.go +++ b/main.go @@ -20,11 +20,13 @@ import ( var ( server = kingpin.Arg("host", "Hostname, IP, or URL of the server to check.").String() sni = kingpin.Flag("sni", "SNI server to use for the certificate (optional).").Short('s').String() + version = "dev" ) func main() { log.SetLogger(new(logger)) + kingpin.Version(version) kingpin.Parse() if server == nil || *server == "" { kingpin.Usage()