Skip to content

Commit 8a30ba1

Browse files
authored
fix: Fix plugin version output (#233)
* fix: Fix plugin version output * fix: Rm unsued import
1 parent 557361a commit 8a30ba1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

plugin/plugin.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"github.com/boson-project/faas/cmd"
55
"knative.dev/client/pkg/kn/plugin"
66
"os"
7+
"runtime/debug"
8+
"strings"
79
)
810

911
func init() {
@@ -17,7 +19,13 @@ func (f *faasPlugin) Name() string {
1719
}
1820

1921
func (f *faasPlugin) Execute(args []string) error {
20-
rootCmd := cmd.NewRootCmd()
22+
rootCmd := cmd.NewRootCmd()
23+
info, _ := debug.ReadBuildInfo()
24+
for _, dep := range info.Deps {
25+
if strings.Contains(dep.Path, "boson-project/faas") {
26+
cmd.SetMeta("", dep.Version, dep.Sum)
27+
}
28+
}
2129
oldArgs := os.Args
2230
defer (func() {
2331
os.Args = oldArgs

0 commit comments

Comments
 (0)