Skip to content

Commit 6c64cb8

Browse files
committed
remove vestigial return from HasMinimumScopes
1 parent 36b2d3f commit 6c64cb8

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

api/client.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,18 @@ type MissingScopesError struct {
200200
error
201201
}
202202

203-
func (c Client) HasMinimumScopes(hostname string) (bool, error) {
203+
func (c Client) HasMinimumScopes(hostname string) error {
204204
apiEndpoint := ghinstance.RESTPrefix(hostname)
205205

206206
req, err := http.NewRequest("GET", apiEndpoint, nil)
207207
if err != nil {
208-
return false, err
208+
return err
209209
}
210210

211211
req.Header.Set("Content-Type", "application/json; charset=utf-8")
212212
res, err := c.http.Do(req)
213213
if err != nil {
214-
return false, err
214+
return err
215215
}
216216

217217
defer func() {
@@ -222,7 +222,7 @@ func (c Client) HasMinimumScopes(hostname string) (bool, error) {
222222
}()
223223

224224
if res.StatusCode != 200 {
225-
return false, handleHTTPError(res)
225+
return handleHTTPError(res)
226226
}
227227

228228
hasScopes := strings.Split(res.Header.Get("X-Oauth-Scopes"), ",")
@@ -247,10 +247,10 @@ func (c Client) HasMinimumScopes(hostname string) (bool, error) {
247247
}
248248

249249
if len(errorMsgs) > 0 {
250-
return false, &MissingScopesError{error: errors.New(strings.Join(errorMsgs, ";"))}
250+
return &MissingScopesError{error: errors.New(strings.Join(errorMsgs, ";"))}
251251
}
252252

253-
return true, nil
253+
return nil
254254
}
255255

256256
// GraphQL performs a GraphQL request and parses the response

pkg/cmd/auth/client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func ValidateHostCfg(hostname string, cfg config.Config) error {
1414
return err
1515
}
1616

17-
_, err = apiClient.HasMinimumScopes(hostname)
17+
err = apiClient.HasMinimumScopes(hostname)
1818
if err != nil {
1919
return fmt.Errorf("could not validate token: %w", err)
2020
}

pkg/cmd/auth/status/status.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func statusRun(opts *StatusOptions) error {
8484
return err
8585
}
8686

87-
_, err = apiClient.HasMinimumScopes(hostname)
87+
err = apiClient.HasMinimumScopes(hostname)
8888
if err != nil {
8989
var missingScopes *api.MissingScopesError
9090
if errors.As(err, &missingScopes) {
@@ -145,7 +145,7 @@ func statusRun(opts *StatusOptions) error {
145145
statusInfo[hostname] = append(statusInfo[hostname], fmt.Sprintf(x, ys...))
146146
}
147147

148-
_, err = apiClient.HasMinimumScopes(hostname)
148+
err = apiClient.HasMinimumScopes(hostname)
149149
if err != nil {
150150
var missingScopes *api.MissingScopesError
151151
if errors.As(err, &missingScopes) {

0 commit comments

Comments
 (0)