File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,10 @@ builds:
1111 - amd64
1212 - arm64
1313 ldflags :
14- - -X 'github.com/pubgo/protobuild/version.Version={{ .Version }}'
14+ - -X 'github.com/pubgo/funk/version.version=v{{ .Version }}'
15+ - -X 'github.com/pubgo/funk/version.project=protobuild'
16+ - -X 'github.com/pubgo/funk/version.buildTime={{ .CommitDate }}'
17+ - -X 'github.com/pubgo/funk/version.commitID={{ .ShortCommit }}'
1518 - main : ./cmd/protoc-gen-retag/main.go
1619 id : protoc-gen-retag
1720 binary : protoc-gen-retag
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import (
1818 "github.com/pubgo/funk/log"
1919 "github.com/pubgo/funk/pathutil"
2020 "github.com/pubgo/funk/recovery"
21+ "github.com/pubgo/funk/running"
2122 "github.com/pubgo/funk/strutil"
2223 "github.com/pubgo/protobuild/cmd/formatcmd"
2324 linters "github.com/pubgo/protobuild/cmd/linters"
@@ -570,6 +571,17 @@ func Main() *cli.Command {
570571 },
571572 },
572573 formatcmd .New ("format" ),
574+ & cli.Command {
575+ Name : "version" ,
576+ Usage : "version info" ,
577+ Action : func (ctx context.Context , command * cli.Command ) error {
578+ defer recovery .Exit ()
579+ fmt .Printf ("Project: %s\n " , running .Project )
580+ fmt .Printf ("Version: %s\n " , running .Version )
581+ fmt .Printf ("GitCommit: %s\n " , running .CommitID )
582+ return nil
583+ },
584+ },
573585 },
574586 }
575587 return app
Original file line number Diff line number Diff line change @@ -36,11 +36,13 @@ require (
3636 bitbucket.org/creachadair/stringset v0.0.14 // indirect
3737 cloud.google.com/go/longrunning v0.6.7 // indirect
3838 github.com/bmatcuk/doublestar/v4 v4.8.1 // indirect
39+ github.com/ettle/strcase v0.2.0 // indirect
3940 github.com/gertd/go-pluralize v0.2.1 // indirect
4041 github.com/go-logr/logr v1.4.3 // indirect
4142 github.com/goccy/go-json v0.10.5 // indirect
4243 github.com/jinzhu/inflection v1.0.0 // indirect
4344 github.com/jinzhu/now v1.1.5 // indirect
45+ github.com/joho/godotenv v1.5.1 // indirect
4446 github.com/k0kubun/pp/v3 v3.5.0 // indirect
4547 github.com/kr/pretty v0.3.1 // indirect
4648 github.com/kr/text v0.2.0 // indirect
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ github.com/emicklei/proto v1.14.2 h1:wJPxPy2Xifja9cEMrcA/g08art5+7CGJNFNk35iXC1I
2424github.com/emicklei/proto v1.14.2 /go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A =
2525github.com/emicklei/proto-contrib v0.18.2 h1:/3HbJnGuiT5x4TgGQjRkPYR5QP2i8sgUgeNbpmOEq+U =
2626github.com/emicklei/proto-contrib v0.18.2 /go.mod h1:0jnPdGJOjrTDObeFfSM1XKx1Z/mjJzYMomI69tJIq58 =
27+ github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q =
28+ github.com/ettle/strcase v0.2.0 /go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A =
2729github.com/flosch/pongo2/v5 v5.0.0 h1:ZauMp+iPZzh2aI1QM2UwRb0lXD4BoFcvBuWqefkIuq0 =
2830github.com/flosch/pongo2/v5 v5.0.0 /go.mod h1:6ysKu++8ANFXmc3x6uA6iVaS+PKUoDfdX3yPcv8TIzY =
2931github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8 =
@@ -57,6 +59,8 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
5759github.com/jinzhu/inflection v1.0.0 /go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc =
5860github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ =
5961github.com/jinzhu/now v1.1.5 /go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8 =
62+ github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0 =
63+ github.com/joho/godotenv v1.5.1 /go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4 =
6064github.com/k0kubun/pp/v3 v3.5.0 h1:iYNlYA5HJAJvkD4ibuf9c8y6SHM0QFhaBuCqm1zHp0w =
6165github.com/k0kubun/pp/v3 v3.5.0 /go.mod h1:5lzno5ZZeEeTV/Ky6vs3g6d1U3WarDrH8k240vMtGro =
6266github.com/kr/pretty v0.2.1 /go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI =
Original file line number Diff line number Diff line change 11package version
22
3- import (
4- ver "github.com/hashicorp/go-version"
5- "github.com/pubgo/funk/assert"
6- )
7-
8- var Version = "v0.0.20"
9-
10- func init () {
11- if Version == "" {
12- Version = "v0.0.1-dev"
13- }
14-
15- assert .Exit1 (ver .NewVersion (Version ))
16- }
3+ var Version = "v0.0.29"
You can’t perform that action at this time.
0 commit comments