From: Mark Adams Date: Fri, 3 Feb 2017 14:46:25 +0000 (-0600) Subject: cmd/go: use Bitbucket v2 REST API when determining VCS X-Git-Tag: go1.9beta1~1618 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=275e1fdb20a3751f5a30f9ec2f0c3fb0b1c8d1d1;p=gostls13.git cmd/go: use Bitbucket v2 REST API when determining VCS The existing implementation uses v1.0 of Bitbucket's REST API. The newer version 2.0 of Bitbucket's REST API provides the same information but with support for partial responses allowing the client to request only the response fields that are relevant to their usage of the API resulting in a much smaller payload size. The partial response functionality in the Bitbucket API is documented here: https://developer.atlassian.com/bitbucket/api/2/reference/meta/partial-response The v2.0 of the Bitbucket repositories API is documented here: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D#get Fixes #18919 Change-Id: I319947d5c51adc241cfe3a2228a667cc43fb1f56 Reviewed-on: https://go-review.googlesource.com/36219 Run-TryBot: Russ Cox Reviewed-by: Russ Cox --- diff --git a/src/cmd/go/internal/get/vcs.go b/src/cmd/go/internal/get/vcs.go index 187f635557..7439cc8649 100644 --- a/src/cmd/go/internal/get/vcs.go +++ b/src/cmd/go/internal/get/vcs.go @@ -948,7 +948,7 @@ func bitbucketVCS(match map[string]string) error { var resp struct { SCM string `json:"scm"` } - url := expand(match, "https://api.bitbucket.org/1.0/repositories/{bitname}") + url := expand(match, "https://api.bitbucket.org/2.0/repositories/{bitname}?fields=scm") data, err := web.Get(url) if err != nil { if httpErr, ok := err.(*web.HTTPError); ok && httpErr.StatusCode == 403 {