File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ builds:
1010 goarch :
1111 - amd64
1212 - arm64
13+ ldflags :
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 }}'
1318 - main : ./cmd/protoc-gen-retag/main.go
1419 id : protoc-gen-retag
1520 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,18 @@ 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 ("Release: %s\n " , version .Version )
582+ fmt .Printf ("GitCommit: %s\n " , running .CommitID )
583+ return nil
584+ },
585+ },
573586 },
574587 }
575588 return app
You can’t perform that action at this time.
0 commit comments