-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from hashicorp/meta-package
meta package
- Loading branch information
Showing
3 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// The meta package provides a location to set the release version | ||
// and any other relevant metadata for the SDK. | ||
// | ||
// This package should not import any other SDK packages. | ||
package meta | ||
|
||
import ( | ||
"fmt" | ||
|
||
version "github.com/hashicorp/go-version" | ||
) | ||
|
||
// The main version number that is being run at the moment. | ||
var SDKVersion = "1.0.0" | ||
|
||
// A pre-release marker for the version. If this is "" (empty string) | ||
// then it means that it is a final release. Otherwise, this is a pre-release | ||
// such as "dev" (in development), "beta", "rc1", etc. | ||
var SDKPrerelease = "dev" | ||
|
||
// SemVer is an instance of version.Version. This has the secondary | ||
// benefit of verifying during tests and init time that our version is a | ||
// proper semantic version, which should always be the case. | ||
var SemVer *version.Version | ||
|
||
func init() { | ||
SemVer = version.Must(version.NewVersion(SDKVersion)) | ||
} | ||
|
||
// VersionString returns the complete version string, including prerelease | ||
func SDKVersionString() string { | ||
if SDKPrerelease != "" { | ||
return fmt.Sprintf("%s-%s", SDKVersion, SDKPrerelease) | ||
} | ||
return SDKVersion | ||
} |