opentofu/scripts
Jake Champlin bd68789006
core: Use environment variables to set VersionPrerelease at compile time
Instead of using a hardcoded version prerelease string, which makes release automation difficult, set the version prerelease string from an environment variable via the go linker tool during compile time.

The environment variable `TF_RELEASE` should only be set via the `make bin` target, and thus leaves the version prerelease string unset. Otherwise, when running a local compile of terraform via the `make dev` makefile target, the version prerelease string is set to `"dev"`, as usual.

This also requires some changes to both the circonus and postgresql providers, as they directly used the `VersionPrerelease` constant. We now simply call the `VersionString()` function, which returns the proper interpolated version string with the prerelease string populated correctly.

`TF_RELEASE` is unset:

```sh
$ make dev
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/22 10:38:19 Generated command/internal_plugin_list.go
==> Removing old directory...
==> Building...
Number of parallel builds: 3

-->     linux/amd64: github.com/hashicorp/terraform

==> Results:
total 209M
-rwxr-xr-x 1 jake jake 209M May 22 10:39 terraform

$ terraform version
Terraform v0.9.6-dev (fd472e4a86500606b03c314f70d11f2bc4bc84e5+CHANGES)
```

`TF_RELEASE` is set (mimicking the `make bin` target):

```sh
$ TF_RELEASE=1 make dev
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/22 10:40:39 Generated command/internal_plugin_list.go
==> Removing old directory...
==> Building...
Number of parallel builds: 3

-->     linux/amd64: github.com/hashicorp/terraform

==> Results:
total 121M
-rwxr-xr-x 1 jake jake 121M May 22 10:42 terraform

$ terraform version
Terraform v0.9.6
```
2017-05-22 10:49:15 -04:00
..
build.sh core: Use environment variables to set VersionPrerelease at compile time 2017-05-22 10:49:15 -04:00
changelog-links.sh Fixed regexp to process comma-separated links to github issues in CHANGELOG.md 2016-10-27 20:07:37 +02:00
dist.sh scripts/dist.sh: tweaks for recent hc-releases 2016-07-15 18:38:47 -06:00
errcheck.sh provider/aws: Run errcheck in tests (#8579) 2016-09-02 09:24:17 -05:00
generate-plugins_test.go scripts: update tests for generate plugins to pass new style 2017-01-26 15:10:03 -08:00
generate-plugins.go core/provider-split: Split out the Oracle OPC provider to new structure (#14362) 2017-05-16 19:53:25 +03:00
gofmtcheck.sh Improve performance of fmtcheck 2016-03-31 13:57:09 -07:00
gogetcookie.sh travis: switch to unencrypted cookie 2016-03-21 13:35:53 -05:00
travis.sh Add script for running tests in Travis 2015-12-22 11:27:04 -05:00