github.com/hashicorp/terraform-plugin-sdk@v1.17.2/meta/meta.go (about)

     1  // The meta package provides a location to set the release version
     2  // and any other relevant metadata for the SDK.
     3  //
     4  // This package should not import any other SDK packages.
     5  package meta
     6  
     7  import (
     8  	"fmt"
     9  
    10  	version "github.com/hashicorp/go-version"
    11  )
    12  
    13  // The main version number that is being run at the moment.
    14  var SDKVersion = "1.17.2"
    15  
    16  // A pre-release marker for the version. If this is "" (empty string)
    17  // then it means that it is a final release. Otherwise, this is a pre-release
    18  // such as "dev" (in development), "beta", "rc1", etc.
    19  var SDKPrerelease = ""
    20  
    21  // SemVer is an instance of version.Version. This has the secondary
    22  // benefit of verifying during tests and init time that our version is a
    23  // proper semantic version, which should always be the case.
    24  var SemVer *version.Version
    25  
    26  func init() {
    27  	SemVer = version.Must(version.NewVersion(SDKVersion))
    28  }
    29  
    30  // VersionString returns the complete version string, including prerelease
    31  func SDKVersionString() string {
    32  	if SDKPrerelease != "" {
    33  		return fmt.Sprintf("%s-%s", SDKVersion, SDKPrerelease)
    34  	}
    35  	return SDKVersion
    36  }