set useDevelopmentVersion correctly for release builds

This commit is contained in:
CJ Horton
2023-04-10 15:56:53 -07:00
parent 49e308e57b
commit 11a68eaa40
2 changed files with 4 additions and 4 deletions

View File

@@ -28,8 +28,7 @@ LDFLAGS="-w -s"
if [[ "$EXPERIMENTS_ENABLED" == 1 ]]; then
LDFLAGS="${LDFLAGS} -X 'main.experimentsAllowed=yes'"
fi
LDFLAGS="${LDFLAGS} -X 'github.com/hashicorp/terraform/version.Version=${BASE_VERSION}'"
LDFLAGS="${LDFLAGS} -X 'github.com/hashicorp/terraform/version.Prerelease=${PRERELEASE}'"
LDFLAGS="${LDFLAGS} -X 'github.com/hashicorp/terraform/version.dev=no'"
echo "Building Terraform CLI ${VERSION}"
if [[ "$EXPERIMENTS_ENABLED" == 1 ]]; then

View File

@@ -41,9 +41,10 @@ export CGO_ENABLED=0
# Set module download mode to readonly to not implicitly update go.mod
export GOFLAGS="-mod=readonly"
# In release mode we don't want debug information in the binary
# In release mode we don't want debug information in the binary and we don't
# want the -dev version marker
if [[ -n "${TF_RELEASE}" ]]; then
LD_FLAGS="-s -w"
LD_FLAGS="-s -w -X 'github.com/hashicorp/terraform/version.dev=no'"
fi
# Ensure all remote modules are downloaded and cached before build so that