File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed
Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments