Azure-sdk-for-go: Breaking Change: futures are no longer populating their Result() causing panic on access

Created on 15 Apr 2021  路  1Comment  路  Source: Azure/azure-sdk-for-go

Bug Report

This is a general approach to the generated SDK, so affects _many_ APIs and versions, if not all that use futures/LROs. The autorest result is no longer being assigned to the future.Response() which means on error, this causes a panic if checked for the response code:

e.g.

    future, err := client.Delete(ctx, id.ResourceGroup, id.HostingEnvironmentName, forceDeleteAllChildren)
    if err != nil {
        if response.WasNotFound(future.Response()) {
            return nil
        }
    }
  • What happened?
    When an LRO errors, this value is checked to be able to surface the result / status to the user. Since this is no longer populated, we get a nil panic:
    panic: runtime error: invalid memory address or nil pointer dereference

A PR that may fix this is here: https://github.com/Azure/autorest.go/pull/605

bug codegen customer-reported

Most helpful comment

Hi @jackofallops thanks for opening this.

The fix in autorest.go for this issue has been merged. And we are planning to release an extra minor version today to refresh every package in the sdk to resolve this.

>All comments

Hi @jackofallops thanks for opening this.

The fix in autorest.go for this issue has been merged. And we are planning to release an extra minor version today to refresh every package in the sdk to resolve this.

Was this page helpful?
0 / 5 - 0 ratings