Skip to content

Commit a3c9d67

Browse files
committed
v2/version: use existing type instead of defining our own
There is no reason to duplicate this definition given that we already import k8s.io/apimachinery anyway.
1 parent 9a6a2e8 commit a3c9d67

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

v2/internal/pkg/version/version.go

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import (
77
"os"
88
"runtime"
99

10-
clog "github.com/openshift/oc-mirror/v2/internal/pkg/log"
1110
"github.com/spf13/cobra"
11+
"k8s.io/apimachinery/pkg/version"
1212
"k8s.io/kubectl/pkg/util/templates"
1313
"sigs.k8s.io/yaml"
14+
15+
clog "github.com/openshift/oc-mirror/v2/internal/pkg/log"
1416
)
1517

1618
var (
@@ -30,18 +32,6 @@ var (
3032
gitTreeState string
3133
)
3234

33-
type Info struct {
34-
Major string `json:"major"`
35-
Minor string `json:"minor"`
36-
GitVersion string `json:"gitVersion"`
37-
GitCommit string `json:"gitCommit"`
38-
GitTreeState string `json:"gitTreeState"`
39-
BuildDate string `json:"buildDate"`
40-
GoVersion string `json:"goVersion"`
41-
Compiler string `json:"compiler"`
42-
Platform string `json:"platform"`
43-
}
44-
4535
type VersionOptions struct {
4636
Output string
4737
Short bool
@@ -50,7 +40,7 @@ type VersionOptions struct {
5040

5141
// Version is a struct for version information
5242
type Version struct {
53-
ClientVersion *Info `json:"clientVersion,omitempty" yaml:"clientVersion,omitempty"`
43+
ClientVersion *version.Info `json:"clientVersion,omitempty" yaml:"clientVersion,omitempty"`
5444
}
5545

5646
func NewVersionCommand(log clog.PluggableLoggerInterface) *cobra.Command {
@@ -126,8 +116,8 @@ func (o *VersionOptions) Run() error {
126116
return nil
127117
}
128118

129-
func Get() Info {
130-
return Info{
119+
func Get() version.Info {
120+
return version.Info{
131121
Major: majorFromGit,
132122
Minor: minorFromGit,
133123
GitCommit: commitFromGit,

0 commit comments

Comments
 (0)