Skip to content

Commit

Permalink
fix: empty version on source build (#1933)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkingland authored Aug 15, 2023
1 parent 1163a5e commit 4927827
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import (
"knative.dev/func/pkg/k8s"
)

// DefaultVersion when building source directly (bypassing the Makefile)
const DefaultVersion = "v0.0.0+source"

type RootCommandConfig struct {
Name string // usually `func` or `kn func`
Version
Expand Down Expand Up @@ -336,6 +339,12 @@ type Version struct {

// Return the stringification of the Version struct.
func (v Version) String() string {
// Initialize the default value to the zero semver with a descriptive
// metadta tag indicating this must have been built from source if
// undefined:
if v.Vers == "" {
v.Vers = DefaultVersion
}
if v.Verbose {
return v.StringVerbose()
}
Expand Down

0 comments on commit 4927827

Please sign in to comment.