mirror of
https://github.com/therootcompany/go-gitver.git
synced 2024-11-16 17:08:59 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
1638772379 | |||
752451d77b | |||
3409d5f2e4 |
@ -1,6 +1,6 @@
|
||||
# [Go GitVer](https://git.rootprojects.org/root/go-gitver)
|
||||
|
||||
Use **git tags** to add (GoRelesear-compatible) [**semver**](https://semver.org/)
|
||||
Use **git tags** to add (GoReleaser-compatible) [**semver**](https://semver.org/)
|
||||
to your go package in under 150
|
||||
[lines of code](https://git.rootprojects.org/root/go-gitver/src/branch/master/gitver/gitver.go).
|
||||
|
||||
@ -28,6 +28,11 @@ See <https://pkg.go.dev/git.rootprojects.org/root/go-gitver/v2>.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
commit = "0000000"
|
||||
version = "0.0.0-pre0+0000000"
|
||||
@ -35,7 +40,7 @@ var (
|
||||
)
|
||||
|
||||
func main() {
|
||||
if (len(os.Args) > 1 && "version" === os.Args[1]) {
|
||||
if (len(os.Args) > 1 && "version" == strings.TrimLeft(os.Args[1], "-")) {
|
||||
fmt.Printf("Foobar v%s (%s) %s\n", version, commit[:7], date)
|
||||
}
|
||||
// ...
|
||||
|
@ -2,6 +2,4 @@ module example.com/hello
|
||||
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
git.rootprojects.org/root/go-gitver/v2 v2.0.1
|
||||
)
|
||||
require git.rootprojects.org/root/go-gitver/v2 v2.0.2
|
||||
|
@ -2,6 +2,4 @@ module example.com/hello
|
||||
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
git.rootprojects.org/root/go-gitver/v2 v2.0.1
|
||||
)
|
||||
require git.rootprojects.org/root/go-gitver/v2 v2.0.2
|
||||
|
@ -2,6 +2,4 @@ module example.com/hello
|
||||
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
git.rootprojects.org/root/go-gitver/v2 v2.0.1
|
||||
)
|
||||
require git.rootprojects.org/root/go-gitver/v2 v2.0.2
|
||||
|
@ -2,6 +2,4 @@ module example.com/hello
|
||||
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
git.rootprojects.org/root/go-gitver/v2 v2.0.1
|
||||
)
|
||||
require git.rootprojects.org/root/go-gitver/v2 v2.0.2
|
||||
|
Loading…
x
Reference in New Issue
Block a user