@@ -14,12 +14,10 @@ See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
*/
16
16
17
- package version
17
+ package main
18
18
19
19
import (
20
20
"fmt"
21
-
22
- "github.com/spf13/cobra"
23
21
)
24
22
25
23
// var needs to be used instead of const as ldflags is used to fill this
34
32
buildDate = "1970-01-01T00:00:00Z" // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ')
35
33
)
36
34
37
- // Version contains all the information related to the CLI version
38
- type Version struct {
35
+ // version contains all the information related to the CLI version
36
+ type version struct {
39
37
KubeBuilderVersion string `json:"kubeBuilderVersion"`
40
38
KubernetesVendor string `json:"kubernetesVendor"`
41
39
GitCommit string `json:"gitCommit"`
@@ -44,33 +42,14 @@ type Version struct {
44
42
GoArch string `json:"goArch"`
45
43
}
46
44
47
- func getVersion () Version {
48
- return Version {
45
+ // versionString returns the CLI version
46
+ func versionString () string {
47
+ return fmt .Sprintf ("Version: %#v" , version {
49
48
kubeBuilderVersion ,
50
49
kubernetesVendorVersion ,
51
50
gitCommit ,
52
51
buildDate ,
53
52
goos ,
54
53
goarch ,
55
- }
56
- }
57
-
58
- // Print prints the CLI version
59
- func (v Version ) Print () {
60
- fmt .Printf ("Version: %#v\n " , v )
61
- }
62
-
63
- // NewCmd creates a new command that prints the CLI version
64
- func NewCmd () * cobra.Command {
65
- return & cobra.Command {
66
- Use : "version" ,
67
- Short : "Print the kubebuilder version" ,
68
- Long : `Print the kubebuilder version` ,
69
- Example : `kubebuilder version` ,
70
- Run : runVersion ,
71
- }
72
- }
73
-
74
- func runVersion (_ * cobra.Command , _ []string ) {
75
- getVersion ().Print ()
54
+ })
76
55
}
0 commit comments