Add new `--fail-floating` option to `GoBuildgen`.

Review Request #3073 - Created Nov. 3, 2015 and submitted

Information
John Sirois
pants
jsirois/issues/2475
2475, 2494
3077
5e01b8d...
Reviewers
pants-reviews
kwlzn, mateor
This advanced option allows a repo to set a policy that floating
3rdparty Go dependencies are not allowed.  When buildgen is run and any
existing or new Go remote libraries are found with no `rev` specified
the build fails and instructions to remedy the situation logged.

There is no support yet for this `--fail-floating` mode when not
`--materializing` targets to disk.

 contrib/go/src/python/pants/contrib/go/tasks/go_buildgen.py             | 98 ++++++++++++++++++++++++++++++++++++++------------
 contrib/go/tests/python/pants_test/contrib/go/tasks/test_go_buildgen.py |  8 +++--
 2 files changed, 81 insertions(+), 25 deletions(-)

Ran locally in --fail-floating mode to tweak presentation.
Looks like so:

./pants buildgen.go --materialize --remote --fail-floating \
  contrib/go/examples/::
...
                    contrib/go/examples/3rdparty/go/github.com/bitly/go-simplejson/BUILD (github.com/bitly/go-simplejson) v0.4.3
                    contrib/go/examples/3rdparty/go/github.com/gorilla/mux/BUILD (github.com/gorilla/mux) FLOATING
                    contrib/go/examples/3rdparty/go/gopkg.in/fsnotify.v0/BUILD (gopkg.in/fsnotify.v0) v0.9.3
                    contrib/go/examples/3rdparty/go/github.com/bmizerany/assert/BUILD (github.com/bmizerany/assert) e17e99893cb6509f428e1728281c2ad60a6b31e3
                    contrib/go/examples/3rdparty/go/github.com/AdRoll/goamz/BUILD (github.com/AdRoll/goamz/dynamodb) 51b70b0035cf28c4ca6d719156347ac56a41d922
                   Un-pinned (FLOATING) Go remote library dependencies are not allowed in this repository!
                   Found the following FLOATING Go remote libraries:
                    contrib/go/examples/3rdparty/go/github.com/gorilla/context/BUILD (github.com/gorilla/context) FLOATING
                    contrib/go/examples/3rdparty/go/github.com/gorilla/mux/BUILD (github.com/gorilla/mux) FLOATING
                   You can fix this by editing the target in each FLOATING BUILD file listed above to include a `rev` parameter that points to a sha, tag or commit id that pins the code in the source repository to a fixed, non-FLOATING version.
FAILURE: Un-pinned (FLOATING) Go remote libraries detected.

15:49:23 00:00   [complete]
               FAILURE

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/89115429

Files


John Sirois
Kelly Ellis
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Mateo Rodriguez
Ship It!
Loading...