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
```
* core/providersplit: Split OPC Provider to separate repo
As we march towards Terraform 0.10.0, we are going to start building the
terraform providers as separate binaries - this will allow us to
continually release them. Before we go to 0.10.0, we need to be able to
continue building providers in the same manner, therefore, we have
hardcoded the path of the provider in the generate-plugins.go file
The interim solution will require us to vendor the opc provider and any
child dependencies, but when we get to 0.10.0, we will no longer have to
do this - the core will auto download the plugin binary. The plugin
package will have it's own dependencies vendored as well.
* core/providersplit: Removing the builtin version of OPC provider
* core/providersplit: Vendoring the OPC plugin
* core/providersplit: update internal plugin list
* core/providersplit: remove unused govendor item
* provider/aws: Add errcheck to Makefile, error on unchecked errors
* more exceptions
* updates for errcheck to pass
* reformat and spilt out the ignore statements
* narrow down ignores
* fix typo, only ignore Close and Write, instead of close or write
Allows specifying `LD_FLAGS` during development builds.
```
$ LD_FLAGS="-linkmode=external" make dev
```
Since the version of DTrace on macOS Sierra (On the public beta's at least) has been updated, this allows DTrace to run on Terraform during development/debugging.
```
$ sudo dtrace -n 'pid$target::main.main:entry' -c "terraform apply"
dtrace: description 'pid$target::main.main:entry' matched 1 probe
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
foo = bar
dtrace: pid 23096 has exited
CPU ID FUNCTION:NAME
2 265673 main.main:entry
```
Also redirects the `@which stringer` command inside the `generate` Makefile target to `/dev/null` so we stop echoing the path to the `stringer` binary on every call to `generate`.
Previously gofmt would run even on files under vendor which we don't care about, and then discard the results. This approach instead selects only the files we want to pass into gofmt.
- Before takes around 6.5 seconds
- Now takes around 2 seconds
Should fix messages like this from the Travis builds:
```
Daily bandwidth rate limit exceeded for IP 52.0.240.122.
```
Refs https://github.com/golang/go/issues/12933
This fixes#4439 by making a compromise: the issues under the "unreleased"
heading will still not be links, because it's inconvenient for the
committers team to write out those links manually for each merge. However,
we'll run this script on release so that all of the *released* changes
are presented as clickable links, so people can quickly read through the
set of changes in each new release.
Doing a straight `./...` build results in errors from unvendored
package references being picked up in some vendored libraries'
`examples/` subdirs.
So we'll switch to the recommended `go list | grep -v /vendor/` strategy
to determine what to build.
* Remove `make updatedeps` from Travis build. We'll follow up with more
specific plans around dependency updating in subsequent PRs.
* Update all `make` targets to set `GO15VENDOREXPERIMENT=1` and to
filter out `/vendor/` from `./...` where appropriate.
* Temporarily remove `vet` from the `make test` target until we can
figure out how to get it to not vet `vendor/`. (Initial
experimentation failed to yield the proper incantation.)
Everything is pinned to current master, with the exception of:
* Azure/azure-sdk-for-go which is pinned before the breaking change today
* aws/aws-sdk-go which is pinned to the most recent tag
The documentation still needs to be updated, which we can do in a follow
up PR. The goal here is to unblock release.
If GOPATH/bin doesn't exists the build scripts just exists, leaving the
`terraform/bin` folder with only one single binary called `terraform`.
Discovered while setting up a new GOPATH just for terraform.
For now, make dev creates in ${MAIN_GOPATH}/bin/ files like 'provider-google' alongside with 'terraform-provider-google'.
If we decided to build plugins with custom names and install them manually with 'cp' command, it could make sense not to do it here.