Skip to content

Commit 4e9a2a6

Browse files
committed
fix: barry quick fix, 2025-08-01 17:45:01
1 parent 0f403a3 commit 4e9a2a6

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.goreleaser.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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

cmd/protobuild/cmd.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)