Skip to content

Commit

Permalink
outscale_oapi: fix warning about var position
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Jutteau <[email protected]>
  • Loading branch information
jerome-jutteau committed Jul 26, 2022
1 parent f259083 commit 0099677
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/providers/outscale_oapi/outscale_oapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (provider *OutscaleOAPI) Types() []ObjectType {
}

func (provider *OutscaleOAPI) AuthTest() error {
err, _ := provider.readAccountId()
_, err := provider.readAccountId()
return err
}

Expand Down Expand Up @@ -802,7 +802,7 @@ func (provider *OutscaleOAPI) deleteNets(nets []Object) {
}
}

func (provider *OutscaleOAPI) readAccountId() (error, *string) {
func (provider *OutscaleOAPI) readAccountId() (*string, error) {
if provider.cache.accountId == nil {
read, httpRes, err := provider.client.AccountApi.ReadAccounts(provider.context).
ReadAccountsRequest(osc.ReadAccountsRequest{}).
Expand All @@ -812,20 +812,20 @@ func (provider *OutscaleOAPI) readAccountId() (error, *string) {
if httpRes != nil {
log.Println(httpRes.Status)
}
return err, nil
return nil, err
}
if len(*read.Accounts) == 0 {
log.Println("Error while reading account: no account listed")
return err, nil
return nil, err
}
provider.cache.accountId = (*read.Accounts)[0].AccountId
}
return nil, provider.cache.accountId
return provider.cache.accountId, nil
}

func (provider *OutscaleOAPI) readImages() []Object {
images := make([]Object, 0)
err, accountId := provider.readAccountId()
accountId, err := provider.readAccountId()
if err != nil {
return images
}
Expand Down Expand Up @@ -874,7 +874,7 @@ func (provider *OutscaleOAPI) deleteImages(images []Object) {

func (provider *OutscaleOAPI) readSnapshots() []Object {
snapshots := make([]Object, 0)
err, accountId := provider.readAccountId()
accountId, err := provider.readAccountId()
if err != nil {
return snapshots
}
Expand Down

0 comments on commit 0099677

Please sign in to comment.