Azure-sdk-for-go: Version v40.0.0 doesn't build

Created on 2 Mar 2020  路  18Comments  路  Source: Azure/azure-sdk-for-go

Hello,

I'm using the subscriptions and graphrbac packages. It appears that version v40.0.0 broke something such that these no longer build properly. I tried every version of the subscriptions package in case some were deprecated, but all failed with the same error. This looks like a problem with go-autorest, perhaps the packages depend on different versions?

# github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions
../vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions/operations.go:98:2: not enough arguments to return
../vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions/operations.go:98:15: client.Send undefined (type OperationsClient has no field or method Send)
../vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go:103:2: not enough arguments to return
../vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go:103:15: client.Send undefined (type Client has no field or method Send)
../vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go:171:2: not enough arguments to return
../vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go:171:15: client.Send undefined (type Client has no field or method Send)
../vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go:282:2: not enough arguments to return
../vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go:282:15: client.Send undefined (type Client has no field or method Send)
../vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions/tenants.go:98:2: not enough arguments to return
../vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions/tenants.go:98:15: client.Send undefined (type TenantsClient has no field or method Send)
../vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions/tenants.go:98:2: too many errors
# github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac
../vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go:114:2: not enough arguments to return
../vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go:114:15: client.Send undefined (type ApplicationsClient has no field or method Send)
../vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go:194:2: not enough arguments to return
../vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go:194:15: client.Send undefined (type ApplicationsClient has no field or method Send)
../vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go:268:2: not enough arguments to return
../vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go:268:15: client.Send undefined (type ApplicationsClient has no field or method Send)
../vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go:341:2: not enough arguments to return
../vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go:341:15: client.Send undefined (type ApplicationsClient has no field or method Send)
../vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go:415:2: not enough arguments to return
../vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go:415:15: client.Send undefined (type ApplicationsClient has no field or method Send)
../vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go:415:2: too many errors

I downgraded my repo back to v30.0.0 and this works fine. It's only a problem with v40.0.0

Mgmt customer-reported customer-response-expected

All 18 comments

Hi @nvelat thanks for this issue.
The reported function is introduced in go-autorest v13.4.0, and comes into go SDK since v39.3.0.
Are you also vendoring go-autorest v13.4.0?
@jhendrixMSFT could you please give some advices about the versioning of go-autorest?

@nvelat when upgrading the SDK you must also upgrade your go-autorest dependency to the minimum version specified in Gopkg.toml. Can you please confirm this resolves your issue?

@ArcturusZhang can you update the README so it's clear that when upgrading the SDK you must also upgrade to the minimum version of go-autorest defined in Gopkg.toml?

@ArcturusZhang can you update the README so it's clear that when upgrading the SDK you must also upgrade to the minimum version of go-autorest defined in Gopkg.toml?

Sure, i will take care of this.

I'm seeing the same issue here. How can I get around it?

@tnguyen14 you need to update your version of go-autorest to at minimum v13.4.0.

@jhendrixMSFT Thanks for the quick response. How could I do that? (I'm very new to Go). I just have a reference to this package in my test code, and the go.mod file.

@tnguyen14 can you please provide the content of your go.mod file?

Sure thing:

:; cat go.mod
module github.com/myorg/azure-instance

go 1.14

require (
        github.com/Azure/azure-sdk-for-go v40.3.0+incompatible
        github.com/gruntwork-io/terratest v0.26.0
        github.com/stretchr/testify v1.5.1
)

Hmm there's no version of go-autorest mentioned. You will need it at some point for authentication (maybe you haven't got that far yet). If you use at minimum autorest/v0.9.6 then it will work.

I see. I was following the example here https://github.com/gruntwork-io/terratest/blob/master/test/terraform_azure_example_test.go when I got the error mentioned at the top of this issue.

Will look into autorest then.

I added the autorest package to the import statement, but running go test still gives me these errors

# github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions
../../../go/pkg/mod/github.com/!azure/[email protected]+incompatible/services/resources/mgmt/2019-06-01/subscriptions/operations.go:98:2: not enough arguments to return
../../../go/pkg/mod/github.com/!azure/[email protected]+incompatible/services/resources/mgmt/2019-06-01/subscriptions/operations.go:98:15: client.Send undefined (type OperationsClient has
 no field or method Send)
../../../go/pkg/mod/github.com/!azure/[email protected]+incompatible/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go:103:2: not enough arguments to return
../../../go/pkg/mod/github.com/!azure/[email protected]+incompatible/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go:103:15: client.Send undefined (type Client has no fi
eld or method Send)
../../../go/pkg/mod/github.com/!azure/[email protected]+incompatible/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go:171:2: not enough arguments to return
../../../go/pkg/mod/github.com/!azure/[email protected]+incompatible/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go:171:15: client.Send undefined (type Client has no fi
eld or method Send)
../../../go/pkg/mod/github.com/!azure/[email protected]+incompatible/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go:282:2: not enough arguments to return
../../../go/pkg/mod/github.com/!azure/[email protected]+incompatible/services/resources/mgmt/2019-06-01/subscriptions/subscriptions.go:282:15: client.Send undefined (type Client has no fi
eld or method Send)
../../../go/pkg/mod/github.com/!azure/[email protected]+incompatible/services/resources/mgmt/2019-06-01/subscriptions/tenants.go:98:2: not enough arguments to return
../../../go/pkg/mod/github.com/!azure/[email protected]+incompatible/services/resources/mgmt/2019-06-01/subscriptions/tenants.go:98:15: client.Send undefined (type TenantsClient has no fi
eld or method Send)
...

Can you share the version of go-autorest that's being imported? It's likely too old.

I don't think go-autorest was imported, even when I put it in the import block.

@jhendrixMSFT do you have any suggestion for how to get around this issue without using go-autorest?

The reason I'm asking is because I get a different error instead when importing go-autorest v0.9.6:

imported and not used: "github.com/Azure/go-aoturest/autorest"

@tnguyen14 you have to use go-autorest as the SDK has a direct dependency on it. The fact that it doesn't get automatically pulled in is because we haven't yet released SDK packages as modules. The compile errors you see are because an older version of go-autorest is being included.

The dependencies are already properly defined in the terratest go.mod file. If you need to use v40.x of the SDK please update this go.mod file with the desired versions.

In case anyone is looking for a quick fix -
go get -u github.com/Azure/go-autorest/autorest
worked for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tombuildsstuff picture tombuildsstuff  路  4Comments

mbfrahry picture mbfrahry  路  4Comments

yannart picture yannart  路  3Comments

njuCZ picture njuCZ  路  3Comments

salameer picture salameer  路  5Comments