Add support for golang.org/x remote libs.

Review Request #2976 - Created Oct. 16, 2015 and submitted

Information
John Sirois
pants
jsirois/issues/2379
2378, 2379, 2380
2980
62770e1...
Reviewers
pants-reviews
kwlzn, mateor, stuhood
Although golang.org/x supports the `go get` <meta> protocol, pants does
not have a `Fetcher` that supports that protocol yet, so just use the
standard `ArchiveFetcher` with a regex mapping that redirects directly
to github (this appears to be the consistent pattern of th golang.org/x
<meta> re-directs).

Add a test to cover this new default fetcher configuration.

 contrib/go/src/python/pants/contrib/go/subsystems/fetchers.py             | 9 +++++++--
 contrib/go/tests/python/pants_test/contrib/go/subsystems/test_fetchers.py | 6 ++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

Manually tested this in a custom Medium pants.ini setup:

[fetchers]
mapping: {
    # Builtin fetchers:
    r'^bitbucket\.org/.*$': 'ArchiveFetcher',
    r'^github\.com/.*$':'ArchiveFetcher',
    r'^gopkg\.in/.*$':'GopkgInFetcher',

    # Our workaround custom fetcher until
    # https://github.com/pantsbuild/pants/issues/2378 or
    # https://github.com/pantsbuild/pants/issues/2379 is resolved.
    r'^golang\.org/x/.*$':'ArchiveFetcher',
  }


[archive-fetcher]
matchers: {
    # Builtin matchers:
    r'bitbucket\.org/(?P<user>[^/]+)/(?P<repo>[^/]+)':
      ('https://bitbucket.org/\\g<user>/\\g<repo>/get/{rev}.tar.gz', 'tip', 1),
    r'github\.com/(?P<user>[^/]+)/(?P<repo>[^/]+)':
      ('https://github.com/\\g<user>/\\g<repo>/archive/{rev}.tar.gz', 'master', 1),

    # Our workaround custom fetcher until
    # https://github.com/pantsbuild/pants/issues/2378 or
    # https://github.com/pantsbuild/pants/issues/2379 is resolved.
    r'golang\.org/x/(?P<user>[^/]+)':
      ('https://github.com/golang/\\g<user>/archive/{rev}.tar.gz', 'master', 1),
  }

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

John Sirois
John Sirois
John Sirois
John Sirois
John Sirois
Stu Hood
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...