Skip to content

Commit c60a53a

Browse files
authored
Merge pull request #1143 from Adirio/cleanup
Solve name collision and document why version strings can not be const
2 parents 17da8c9 + 958f5ed commit c60a53a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

cmd/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ func main() {
116116
version.NewVersionCmd(),
117117
)
118118

119-
foundProject, version := getProjectVersion()
120-
if foundProject && version == project.Version1 {
119+
foundProject, projectVersion := getProjectVersion()
120+
if foundProject && projectVersion == project.Version1 {
121121
printV1DeprecationWarning()
122122

123123
rootCmd.AddCommand(

cmd/version/version.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
"github.com/spf13/cobra"
2323
)
2424

25+
// var needs to be used instead of const as ldflags is used to fill this
26+
// information in the release process
2527
var (
2628
kubeBuilderVersion = "unknown"
2729
kubernetesVendorVersion = "unknown"
@@ -41,7 +43,7 @@ type Version struct {
4143
GoArch string `json:"goArch"`
4244
}
4345

44-
func GetVersion() Version {
46+
func getVersion() Version {
4547
return Version{
4648
kubeBuilderVersion,
4749
kubernetesVendorVersion,
@@ -67,5 +69,5 @@ func NewVersionCmd() *cobra.Command {
6769
}
6870

6971
func runVersion(_ *cobra.Command, _ []string) {
70-
GetVersion().Print()
72+
getVersion().Print()
7173
}

0 commit comments

Comments
 (0)