Skip to content

Commit

Permalink
Fix config.GetSemverInfo() for Go 1.18
Browse files Browse the repository at this point in the history
In Go 1.18 debug.ReadBuildInfo() may successfully return a build
info where the main version is empty. Return the default SemVer
in this case.
  • Loading branch information
emmanuel099 committed Mar 28, 2022
1 parent e0e183b commit fa0080c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/config/config.go
Expand Up @@ -14,7 +14,7 @@ func GetSemverInfo() string {
return SemVer
}
version, ok := debug.ReadBuildInfo()
if ok && version.Main.Version != "(devel)" {
if ok && version.Main.Version != "(devel)" && version.Main.Version != "" {
return version.Main.Version
}
return _defaultSemVer
Expand Down

0 comments on commit fa0080c

Please sign in to comment.