Skip to content

Commit 89521ce

Browse files
committed
update main to print version on start
1 parent a48557c commit 89521ce

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

.goreleaser.yml

-9
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ release:
44
owner: bketelsen
55
name: captainhook
66
name_template: '{{.Tag}}'
7-
brew:
8-
commit_author:
9-
name: captainhook
10-
email: bketelsen@gmail.com
11-
install: bin.install "newgo"
127
builds:
138
- goos:
149
- linux
@@ -34,10 +29,6 @@ archive:
3429
- README*
3530
- changelog*
3631
- CHANGELOG*
37-
fpm:
38-
bindir: /usr/local/bin
39-
snapshot:
40-
name_template: SNAPSHOT-{{.Commit }}
4132
checksum:
4233
name_template: '{{.ProjectName }}_{{.Version }}_checksums.txt'
4334

main.go

+9
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ package main
22

33
import (
44
"flag"
5+
"fmt"
56
"log"
67
"net/http"
8+
"time"
79

810
"github.com/gorilla/mux"
911
)
@@ -12,6 +14,7 @@ var (
1214
configdir string
1315
echo bool
1416
proxy bool
17+
version bool
1518
proxyHeader string
1619
listenAddr string
1720
)
@@ -26,6 +29,12 @@ func init() {
2629

2730
func main() {
2831
flag.Parse()
32+
33+
if BuildDate == "" {
34+
BuildDate = time.Now().Format("15:04:05 Jan 2, 2006")
35+
}
36+
fmt.Printf("captain hook version %s built %v\n", Version, BuildDate)
37+
2938
if configdir == "" {
3039
log.Fatal("configdir is required")
3140
}

version.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
// Version is the tagged version or "dev"
4+
var Version = "dev"
5+
6+
// BuildDate is the date of the release build or ""
7+
var BuildDate = ""

0 commit comments

Comments
 (0)