Skip to content

Commit

Permalink
update main to print version on start
Browse files Browse the repository at this point in the history
  • Loading branch information
bketelsen committed Mar 2, 2018
1 parent a48557c commit 89521ce
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
9 changes: 0 additions & 9 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ release:
owner: bketelsen
name: captainhook
name_template: '{{.Tag}}'
brew:
commit_author:
name: captainhook
email: bketelsen@gmail.com
install: bin.install "newgo"
builds:
- goos:
- linux
Expand All @@ -34,10 +29,6 @@ archive:
- README*
- changelog*
- CHANGELOG*
fpm:
bindir: /usr/local/bin
snapshot:
name_template: SNAPSHOT-{{.Commit }}
checksum:
name_template: '{{.ProjectName }}_{{.Version }}_checksums.txt'

9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package main

import (
"flag"
"fmt"
"log"
"net/http"
"time"

"github.com/gorilla/mux"
)
Expand All @@ -12,6 +14,7 @@ var (
configdir string
echo bool
proxy bool
version bool
proxyHeader string
listenAddr string
)
Expand All @@ -26,6 +29,12 @@ func init() {

func main() {
flag.Parse()

if BuildDate == "" {
BuildDate = time.Now().Format("15:04:05 Jan 2, 2006")
}
fmt.Printf("captain hook version %s built %v\n", Version, BuildDate)

if configdir == "" {
log.Fatal("configdir is required")
}
Expand Down
7 changes: 7 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

// Version is the tagged version or "dev"
var Version = "dev"

// BuildDate is the date of the release build or ""
var BuildDate = ""

0 comments on commit 89521ce

Please sign in to comment.