Commit Graph

80 Commits

Author SHA1 Message Date
Clint 740b8bb9cb provider/aws: Run errcheck in tests (#8579)
* 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
2016-09-02 09:24:17 -05:00
Jake Champlin 8cbef79dbf Allow specifying ldflags via env vars
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`.
2016-08-24 10:56:23 -04:00
John Bowler 922e626b7e Fix Makefile for consistency 2016-07-07 11:11:28 -07:00
John Bowler 4a84697b7d Support `make test` if TF itself is vendored 2016-07-06 19:17:35 -07:00
James Nugent 27d21778a2 build: Allow TESTARGS on make core-test 2016-06-22 16:32:43 +03:00
James Nugent 3593ea8b0a build: Remove format check from plugin-dev
This is intended to reduce cycle time during provider development.
2016-06-11 13:27:08 +01:00
James Nugent 1b011dedf4 build: Skip running tests on /builtin/bins
This is time consuming and spams the output of Travis - to run no tests.
2016-06-11 13:09:19 +01:00
James Nugent 8895b567f4 build: Add tools target to Makefile 2016-06-02 23:22:20 -05:00
Martin Atkins 78a9f8bfb4 build: "make fmt" to ignore vendor packages
Several of our vendered dependencies are not gofmt-compliant, but we don't
want to fix that since the vendored code is supposed to exactly match
upstream.
2016-05-10 15:40:02 -07:00
James Nugent 0c56144d7f build: Only build once for core-dev 2016-05-10 14:49:13 -04:00
Chris Bednarski 6360e6c8b6 Implemented internal plugin calls; which allows us to compile plugins into the main terraform binary 2016-05-10 14:40:11 -04:00
Poney baker 03c64b9ba5 fix(Makefile): remove 'updatedeps' from .PHONY 2016-05-10 14:30:31 +02:00
Martin Atkins a1530855a3 Build release binaries in release mode
This strips debug information from the binaries, making them slightly
smaller.
2016-04-19 09:50:46 -07:00
James Nugent 9c236e7508 build: Remove gofmt check from core-dev target 2016-04-13 08:40:35 -05:00
Joshua Spence cfc2890310 Remove TF_QUICKDEV environment variable
This environment variable doesn't seem to be used, the last usage was removed in 6fe2703665.
2016-04-09 21:56:25 +10:00
James Nugent 76f203e7e4 build: Update make core-test for vendoring 2016-03-03 18:08:31 -06:00
Paul Hinze d21b0897a9 Makefile/docs: Lock in 1.6 req, doc vendored deps
* Drop Go 1.5 compatibility env vars
 * Drop `make updatedeps` from `Makefile` and docs
 * Update README w/ vendored dep instructions
2016-02-24 16:13:49 -06:00
James Nugent ac957ab329 Run `vet` target on `default` target 2016-02-22 13:35:50 -05:00
Trevor Pounds ebe5346e8f Enable all `go vet` warnings. 2016-02-17 13:29:51 -08:00
James Nugent bc6107508d Fix additional vet warnings 2016-02-17 11:59:50 -08:00
Trevor Pounds 3eb65f2cbb Enable `go vet -unusedresult` check and fix warnings. 2016-02-17 11:59:50 -08:00
Trevor Pounds 79742fc367 Enable `go vet -composites` check and fix warnings. 2016-02-17 11:59:50 -08:00
Trevor Pounds 8e6d11fc5e Do not `go vet` vendor dependencies. 2016-02-17 11:59:49 -08:00
Paul Hinze 6fe2703665 Vendor all dependencies w/ Godep
* 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.
2016-01-29 15:08:48 -06:00
James Nugent fc667b6763 core: Add `make core-test` target 2016-01-21 18:01:21 -05:00
James Nugent c4c5a0c7d4 Increase acceptance test timeout to 120m from 90m 2016-01-07 13:02:04 -08:00
James Nugent 6d6487e288 Make gofmt errors fail build and add `make fmt`
We may want to consider requiring `gofmt -s` compliance in future
builds, but for now we just use `gofmt`.
2015-12-17 12:35:13 -05:00
James Nugent 54ce59ebdd Remove release target and document cross-compiling
Also document the `plugin-dev` and `core-dev` targets.
2015-12-08 13:10:40 -05:00
Philipp Preß a4c62673ee Remove redundant -build-toolchain for gox
Running `make release` on the provided Vagrant machine errors with an error.

Removing the `-build-toolchain` fixes it.
2015-12-08 15:09:04 +01:00
James Nugent 13548fcaa2 Add `core-dev` target to Makefile
This is shorthand to build and install the core of terraform, without
touching the providers.
2015-11-18 16:59:58 +02:00
Martin Atkins 3af5552b54 Makefile target to build a single plugin for local testing.
Often when developing a plugin it's only necessary to rebuild that plugin.
Here we add a simple Makefile target that makes that easy:

    make plugin-dev PLUGIN=provider-aws

Since it's only building one package and it's only building for the
host architecture, this just uses "go install" directly, rather than using
gox as we do when installing multiple packages, possibly for multiple
architectures.
2015-10-11 14:24:23 -07:00
Florin Patan a75ca1e25c Support go get in go 1.5 2015-07-31 00:34:58 +02:00
Paul Hinze 4a65d83741 maint: Codify a Vagrant-based release process
* update Vagrantfile to modern Consul-style version
 * add `make release` for a one-shot command to get from fresh vagrant
   machine to a built release
 * add RELEASING.md to document details about the release process
2015-06-01 10:34:13 -05:00
Radek Simko bb864fb527 Increase default timeout for acceptance tests 2015-05-31 17:08:57 +01:00
Paul Hinze be2ec7a61a Makefile: make go vet break the build 2015-05-30 12:52:24 -05:00
Chris Bednarski a1dd906f2e Move TEST to end of line 2015-05-29 10:56:15 -07:00
Chris Bednarski 106af364b3 Change the example to something that actually works 2015-05-29 10:55:16 -07:00
Chris Bednarski 7e51225ca9 Tweak some of the makefile help messages for clarity 2015-05-29 10:45:20 -07:00
Jeff Mitchell 996e7ff3e4 Add quickdev option; skips getting dependencies to make repeated builds a bit faster and less network-heavy 2015-03-06 17:07:16 +00:00
Mitchell Hashimoto e60a614a37 Add cover tasks to test code coverage 2015-02-19 12:08:32 -08:00
Patrick Lucas bcc85be991 Remove 'go get ... vet' from updatedeps target
This package attempts to install itself to GOROOT which will fail for
non-root users. Most users will have already installed the vet tool via a
system package, so it shouldn't be necessary to 'go get' here.

Moreover, the 'vet' make target already checks that it is installed before
running it, running 'go get' if necessary.

This is the output when running 'make updatedeps' as a regular user
without this change:

```
$ make updatedeps
go get -u github.com/mitchellh/gox
go get -u golang.org/x/tools/cmd/stringer
go get -u golang.org/x/tools/cmd/vet
go install golang.org/x/tools/cmd/vet: open /usr/local/go/pkg/tool/linux_amd64/vet: permission denied
make: *** [updatedeps] Error 1
```
2015-02-02 12:17:37 -08:00
Paul Hinze b8fb0c0838 Makefile: simplify updatedeps; no need for deplist
After discussing with the very gracious @cespare over at
https://github.com/cespare/deplist/pull/2 I now understand that we can
pull off the same logic with just `go list`.

The logic is now simpler and more consistent:

 * List out all packages in our repo
 * For each of those packages, list their dependencies
 * Filter out any dependencies that already live in this repo
 * Remove duplicates
 * And fetch the rest. `go get` will work out all transitive dependencies
   from there
2015-01-30 18:29:12 -06:00
Paul Hinze a764adbf1b Makefile: new deps strategy fixes deps in branches
Currently when running `make updatedeps` from a branch, the dependency
list from master ends up getting used. We tried to work around this in
35490f7812, and got part way there, but
here's what was happening:

 - record the current SHA
 - run `go get -f -u -v ./...` which ends up checking out master
 - master is checked out early in the `go get` process, which means all
   subsequent dependencies are resolved from master
 - re-checkout the recorded SHA
 - run tests

This works in most cases, except when the branch being tested actually
changes the list of dependencies in some way.

Here we move away from letting `go get -v` walk through everything in
`./...`, instead building our own list of dependencies with the help of
`deplist`. We can then filter terraform packages out from the list, so
they don't get touched, and safely update the rest.

This should solve problems like those observed in #899 and #900.

__Note__: had to add a feature to deplist to make this work properly;
see 016ef97111
Working on getting it accepted upstream.
2015-01-30 16:27:54 -06:00
Mitchell Hashimoto 703a11ed7e Comment Makefile 2015-01-26 18:19:32 -08:00
Paul Hinze bba3890f32 Makefile: bump test timeout from 10s to 30s
on a slow internet connection, the BitBucket tests were taking over 10s
and panicing the test run
2015-01-24 07:57:15 -08:00
Paul Hinze f69bdb608c Makefile: roll gox into updatedeps
No need to have an extra dev bootstrapping step when we can automate it!
2015-01-20 17:38:19 -08:00
Emil Hessman 65878791c0 Makefile: add vet target
Add a vet target in order to catch suspicious constructs
reported by go vet.

Vet has successfully detected problems in the past,
for example, see

  482460c4c8
  fc36b1cd94
  68a41035a9
  7b704fb77d
  4f3f85b165
  95fa353ee9
  4bfe18b40d

Some vet flags are noisy. In particular, the following flags
reports a large amount of generally unharmful constructs:

  -assign: check for useless assignments
  -composites: check that composite literals used field-keyed
               elements
  -shadow: check for shadowed variables
  -shadowstrict: whether to be strict about shadowing
  -unreachable: check for unreachable code

In order to skip running the flags mentioned above, vet is
invoked on a directory basis with 'go tool vet .' since package-
level type-checking with 'go vet' doesn't accept flags.

Hence, each file is vetted in isolation, which is weaker than
package-level type-checking. But nevertheless, it might catch
suspicious constructs that pose a real problem.

The vet target runs the following flags on the entire repo:

  -asmdecl: check assembly against Go declarations
  -atomic: check for common mistaken usages of the
           sync/atomic package
  -bool: check for mistakes involving boolean operators
  -buildtags: check that +build tags are valid
  -copylocks: check that locks are not passed by value
  -methods: check that canonically named methods are canonically
            defined
  -nilfunc: check for comparisons between functions and nil
  -printf: check printf-like invocations
  -rangeloops: check that range loop variables are used correctly
  -shift: check for useless shifts
  -structtags: check that struct field tags have canonical format
               and apply to exported fields as needed
  -unsafeptr: check for misuse of unsafe.Pointer

Now and then, it might make sense to check the output of

VETARGS=-unreachable make vet

manually, just in case it detects several lines of dead code etc.
2015-01-16 22:20:32 +01:00
Mitchell Hashimoto a7cad594df update Makefile to better switch to correct branch on updatedeps 2015-01-16 09:38:20 -08:00
Mitchell Hashimoto 35490f7812 updatedeps should checkout the last checked out branch [GH-816] 2015-01-16 09:07:12 -08:00
Sander van Harmelen d823db5963 Removed obsolete chars 2015-01-15 22:03:43 +01:00