@@ -105,9 +105,13 @@ type VersionState struct {
105
105
// version is the same or greater it returns nothing.
106
106
func (v * versionChecker ) Check (ctx context.Context ) (string , error ) {
107
107
log := logf .Log
108
- cliVer , err := semver .ParseTolerant (v .cliVersion ().GitVersion )
109
- if err != nil {
110
- return "" , errors .Wrap (err , "unable to semver parse clusterctl GitVersion" )
108
+ var cliVer semver.Version
109
+ var err error
110
+ if v .cliVersion ().GitVersion != "" {
111
+ cliVer , err = semver .ParseTolerant (v .cliVersion ().GitVersion )
112
+ if err != nil {
113
+ return "" , errors .Wrap (err , "unable to semver parse clusterctl GitVersion" )
114
+ }
111
115
}
112
116
113
117
release , err := v .getLatestRelease (ctx )
@@ -122,8 +126,8 @@ func (v *versionChecker) Check(ctx context.Context) (string, error) {
122
126
return "" , errors .Wrap (err , "unable to semver parse latest release version" )
123
127
}
124
128
125
- // if we are using a dirty dev build, just log it out
126
- if strings .HasSuffix (cliVer .String (), "-dirty" ) {
129
+ // if we are using a dirty dev build or go build , just log it out
130
+ if v . cliVersion (). GitVersion == "" || strings .HasSuffix (cliVer .String (), "-dirty" ) {
127
131
log .V (1 ).Info ("⚠️ Using a development build of clusterctl." , "cliVersion" , cliVer .String (), "latestGithubRelease" , release .Version )
128
132
return "" , nil
129
133
}
0 commit comments