From b1dfa4a5a9a248419a776c43217504d4d5605a1b Mon Sep 17 00:00:00 2001 From: folex <0xdxdy@gmail.com> Date: Sat, 28 Apr 2018 10:25:30 +0300 Subject: [PATCH] Fix PR comments full_name -> fullName "%s" -> %q errors.New -> fmt.Errorf --- remote/bitbucket/internal/client.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/remote/bitbucket/internal/client.go b/remote/bitbucket/internal/client.go index 1b98dec95..374e280d4 100644 --- a/remote/bitbucket/internal/client.go +++ b/remote/bitbucket/internal/client.go @@ -22,7 +22,6 @@ import ( "net/http" "net/url" - "github.com/pkg/errors" "golang.org/x/oauth2" "golang.org/x/oauth2/bitbucket" ) @@ -37,7 +36,7 @@ const ( const ( pathUser = "%s/2.0/user/" pathEmails = "%s/2.0/user/emails" - pathPermissions = "%s/2.0/user/permissions/repositories?q=repository.full_name=\"%s\"" + pathPermissions = "%s/2.0/user/permissions/repositories?q=repository.full_name=%q" pathTeams = "%s/2.0/teams/?%s" pathRepo = "%s/2.0/repositories/%s/%s" pathRepos = "%s/2.0/repositories/%s?%s" @@ -154,9 +153,9 @@ func (c *Client) CreateStatus(owner, name, revision string, status *BuildStatus) return c.do(uri, post, status, nil) } -func (c *Client) GetPermission(full_name string) (*RepoPerm, error) { +func (c *Client) GetPermission(fullName string) (*RepoPerm, error) { out := new(RepoPermResp) - uri := fmt.Sprintf(pathPermissions, c.base, full_name) + uri := fmt.Sprintf(pathPermissions, c.base, fullName) err := c.do(uri, get, nil, out) if err != nil { @@ -164,8 +163,7 @@ func (c *Client) GetPermission(full_name string) (*RepoPerm, error) { } if len(out.Values) == 0 { - err = errors.New(fmt.Sprint("no permissions in repository ", full_name)) - return nil, err + return nil, fmt.Errorf("no permissions in repository ", fullName) } else { return out.Values[0], nil }