mirror of
https://github.com/opentofu/opentofu.git
synced 2026-05-21 17:47:24 -04:00
Some checks are pending
build / Build for freebsd_386 (push) Waiting to run
build / Build for linux_386 (push) Waiting to run
build / Build for openbsd_386 (push) Waiting to run
build / Build for windows_386 (push) Waiting to run
build / Build for freebsd_amd64 (push) Waiting to run
build / Build for linux_amd64 (push) Waiting to run
build / Build for openbsd_amd64 (push) Waiting to run
build / Build for solaris_amd64 (push) Waiting to run
build / Build for windows_amd64 (push) Waiting to run
build / Build for freebsd_arm (push) Waiting to run
build / Build for linux_arm (push) Waiting to run
build / Build for linux_arm64 (push) Waiting to run
build / Build for darwin_amd64 (push) Waiting to run
build / Build for darwin_arm64 (push) Waiting to run
build / End-to-end Tests for linux_386 (push) Waiting to run
build / End-to-end Tests for windows_386 (push) Waiting to run
build / End-to-end Tests for darwin_amd64 (push) Waiting to run
build / End-to-end Tests for linux_amd64 (push) Waiting to run
build / End-to-end Tests for windows_amd64 (push) Waiting to run
Quick Checks / List files changed for pull request (push) Waiting to run
Quick Checks / Unit tests for linux_386 (push) Blocked by required conditions
Quick Checks / Unit tests for linux_amd64 (push) Blocked by required conditions
Quick Checks / Unit tests for windows_amd64 (push) Blocked by required conditions
Quick Checks / Unit tests for linux_arm (push) Blocked by required conditions
Quick Checks / Unit tests for darwin_arm64 (push) Blocked by required conditions
Quick Checks / Unit tests for linux_arm64 (push) Blocked by required conditions
Quick Checks / Race Tests (push) Blocked by required conditions
Quick Checks / End-to-end Tests (push) Blocked by required conditions
Quick Checks / Code Consistency Checks (push) Blocked by required conditions
Quick Checks / License Checks (push) Waiting to run
Website checks / List files changed for pull request (push) Waiting to run
Website checks / Build (push) Blocked by required conditions
Website checks / Test Installation Instructions (push) Blocked by required conditions
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
73 lines
2.2 KiB
Go
73 lines
2.2 KiB
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// The version package provides a location to set the release versions for all
|
|
// packages to consume, without creating import cycles.
|
|
//
|
|
// This package should not import any other terraform packages.
|
|
package version
|
|
|
|
import (
|
|
_ "embed"
|
|
"fmt"
|
|
"strings"
|
|
|
|
version "github.com/hashicorp/go-version"
|
|
)
|
|
|
|
// rawVersion is the current version as a string, as read from the VERSION
|
|
// file. This must be a valid semantic version.
|
|
//
|
|
//go:embed VERSION
|
|
var rawVersion string
|
|
|
|
// dev determines whether the -dev prerelease marker will
|
|
// be included in version info. It is expected to be set to "no" using
|
|
// linker flags when building binaries for release.
|
|
var dev string = "yes"
|
|
|
|
// The main version number that is being run at the moment, populated from the raw version.
|
|
var Version string
|
|
|
|
// A pre-release marker for the version, populated using a combination of the raw version
|
|
// and the dev flag.
|
|
var Prerelease string
|
|
|
|
// SemVer is an instance of version.Version representing the main version
|
|
// without any prerelease information.
|
|
var SemVer *version.Version
|
|
|
|
func init() {
|
|
semVerFull := version.Must(version.NewVersion(strings.TrimSpace(rawVersion)))
|
|
SemVer = semVerFull.Core()
|
|
Version = SemVer.String()
|
|
|
|
if dev == "no" {
|
|
Prerelease = semVerFull.Prerelease()
|
|
} else {
|
|
Prerelease = "dev"
|
|
}
|
|
}
|
|
|
|
// Header is the header name used to send the current terraform version
|
|
// in http requests.
|
|
const Header = "Terraform-Version"
|
|
|
|
// String returns the complete version string, including prerelease
|
|
func String() string {
|
|
if Prerelease != "" {
|
|
return fmt.Sprintf("%s-%s", Version, Prerelease)
|
|
}
|
|
return Version
|
|
}
|
|
|
|
// This ONLY represents what features OpenTofu currently intends to support from
|
|
// providers which may change their behavior given a particular TerraformVersion.
|
|
// It explicitly does NOT represent any sort of compatibility promise or guarantee.
|
|
// This value should ONLY ever be used by the provider.ConfigureProvider call, any
|
|
// other usage is WRONG and a PROGRAMMING ERROR.
|
|
// This value should be carefully updated as we add OpenTofu support for new protocol
|
|
// features.
|
|
const VersionToImpersonateForProviders = "1.13.0"
|