Skip to content

Commit 8b067e0

Browse files
committed
Make gopack version accessible from the cli
Signed-off-by: Ryan Fowler <[email protected]>
1 parent 0903e8d commit 8b067e0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: cmd/gopack/main.go

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"context"
1919
"fmt"
2020
"os"
21+
"runtime/debug"
2122
"strings"
2223

2324
"github.com/ryanfowler/gopack/internal/oci"
@@ -44,6 +45,10 @@ var (
4445
)
4546

4647
func init() {
48+
if info, ok := debug.ReadBuildInfo(); ok {
49+
rootCmd.Version = info.Main.Version
50+
}
51+
4752
rootCmd.AddCommand(runCmd)
4853

4954
runCmd.Flags().StringVarP(&base, "base", "b", "gcr.io/distroless/static:nonroot", "repository to use as the base image")

0 commit comments

Comments
 (0)