versioning and .gitignore updates

This commit is contained in:
AJ ONeal 2019-06-21 01:03:15 -06:00
parent 8225a5a609
commit d5c026948c
8 changed files with 19 additions and 13 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/watchdog /watchdog
/cmd/watchdog/watchdog /cmd/watchdog/watchdog
xversion.go xversion.go
*.json

7
cmd/watchdog/version.go Normal file
View File

@ -0,0 +1,7 @@
package main
// Fallback to recent version if not in a git repository
func init() {
GitVersion = "v1.1.2"
GitTimestamp = "2019-06-21T00:54:34-06:00"
}

View File

@ -14,11 +14,7 @@ import (
watchdog "git.rootprojects.org/root/watchdog.go" watchdog "git.rootprojects.org/root/watchdog.go"
) )
var ( var GitRev, GitVersion, GitTimestamp string
GitRev = "00000000"
GitVersion = "v0.0.0"
GitTimestamp = "0000-00-00T00:00:00Z"
)
func usage() { func usage() {
fmt.Println("Usage: watchdog -c config.json") fmt.Println("Usage: watchdog -c config.json")

2
go.mod
View File

@ -2,4 +2,4 @@ module git.rootprojects.org/root/watchdog.go
go 1.12 go 1.12
require git.rootprojects.org/root/go-gitver v1.1.0 require git.rootprojects.org/root/go-gitver v1.1.1

2
go.sum
View File

@ -1,2 +1,4 @@
git.rootprojects.org/root/go-gitver v1.1.0 h1:ANQUnUXYgbDR+WaMcI+PQQjLnxlCbAZCD/zivkrf8fY= git.rootprojects.org/root/go-gitver v1.1.0 h1:ANQUnUXYgbDR+WaMcI+PQQjLnxlCbAZCD/zivkrf8fY=
git.rootprojects.org/root/go-gitver v1.1.0/go.mod h1:Rj1v3TBhvdaSphFEqMynUYwAz/4f+wY/+syBTvRrmlI= git.rootprojects.org/root/go-gitver v1.1.0/go.mod h1:Rj1v3TBhvdaSphFEqMynUYwAz/4f+wY/+syBTvRrmlI=
git.rootprojects.org/root/go-gitver v1.1.1 h1:5b0lxnTYnft5hqpln0XCrJaGPH0SKzhPaazVAvAlZ8I=
git.rootprojects.org/root/go-gitver v1.1.1/go.mod h1:Rj1v3TBhvdaSphFEqMynUYwAz/4f+wY/+syBTvRrmlI=

View File

@ -60,7 +60,7 @@ You don't have to use `mod vendor`, but I highly recommend it.
# Options # Options
``` ```txt
version print version and exit version print version and exit
--fail exit with non-zero status code on failure --fail exit with non-zero status code on failure
--package <name> will set the package name --package <name> will set the package name
@ -69,7 +69,7 @@ version print version and exit
ENVs ENVs
``` ```bash
# Alias for --fail # Alias for --fail
GITVER_FAIL=true GITVER_FAIL=true
``` ```

View File

@ -209,9 +209,9 @@ package {{ .Package }}
func init() { func init() {
GitRev = "{{ .GitRev }}" GitRev = "{{ .GitRev }}"
if "" != "{{ .Version }}" { {{- if .Version }}
GitVersion = "{{ .Version }}" GitVersion = "{{ .Version }}"
} {{ end -}}
GitTimestamp = "{{ .Timestamp }}" GitTimestamp = "{{ .Timestamp }}"
} }
`)) `))

2
vendor/modules.txt vendored
View File

@ -1,2 +1,2 @@
# git.rootprojects.org/root/go-gitver v1.1.0 # git.rootprojects.org/root/go-gitver v1.1.1
git.rootprojects.org/root/go-gitver git.rootprojects.org/root/go-gitver