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
/cmd/watchdog/watchdog
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"
)
var (
GitRev = "00000000"
GitVersion = "v0.0.0"
GitTimestamp = "0000-00-00T00:00:00Z"
)
var GitRev, GitVersion, GitTimestamp string
func usage() {
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
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/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
```
```txt
version print version and exit
--fail exit with non-zero status code on failure
--package <name> will set the package name
@ -69,7 +69,7 @@ version print version and exit
ENVs
```
```bash
# Alias for --fail
GITVER_FAIL=true
```
@ -142,7 +142,7 @@ the repository in itself and that would be... weird.
# Why a tools package?
> import "git.rootprojects.org/root/go-gitver" is a program, not an importable package
> import "git.rootprojects.org/root/go-gitver" is a program, not an importable package
Having a tools package with a build tag that you don't use is a nice way to add exact
versions of a command package used for tooling to your `go.mod` with `go mod tidy`,

View File

@ -209,9 +209,9 @@ package {{ .Package }}
func init() {
GitRev = "{{ .GitRev }}"
if "" != "{{ .Version }}" {
GitVersion = "{{ .Version }}"
}
{{- if .Version }}
GitVersion = "{{ .Version }}"
{{ end -}}
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