weather/internal/version/version.go

32 lines
618 B
Go

package version
import (
"fmt"
version "github.com/hashicorp/go-version"
)
//Version ...
const Version = "1.0.0"
//Prerelease such as "dev" (in development), "beta", "rc1", etc.
var Prerelease = "dev"
//SemVer management
var SemVer *version.Version
func init() {
SemVer = version.Must(version.NewVersion(Version))
}
// Header is the header name used to send the current in http requests.
const Header = "Weather-Version"
// String returns the complete version string, including prerelease
func String() string {
if Prerelease != "" {
return fmt.Sprintf("%s-%s", Version, Prerelease)
}
return Version
}