Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot find module providing package github.com/Azure/azure-sdk-for-go/sdk/internal/runtime #15384

Closed
adeturner opened this issue Aug 26, 2021 · 15 comments
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. EngSys This issue is impacting the engineering system.

Comments

@adeturner
Copy link

adeturner commented Aug 26, 2021

In WSL2, I'm naively trying to install the SDK, it cant find sdk/internal/runtime package

$ go version

go version go1.16.5 linux/amd64

$ go get -u -d github.com/Azure/azure-sdk-for-go/...

go: downloading github.com/Azure/azure-sdk-for-go v56.3.0+incompatible
go: downloading github.com/Azure/azure-sdk-for-go/sdk/armcore v0.8.0
go: downloading github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0
go: downloading github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0
go: downloading github.com/Azure/azure-sdk-for-go/sdk/monitor/armmonitor v0.1.0
go: downloading github.com/Azure/go-autorest v14.2.0+incompatible
go: downloading github.com/Azure/go-autorest/autorest v0.11.19
go: downloading github.com/Azure/go-autorest/autorest/date v0.3.0
go: downloading github.com/Azure/go-autorest/autorest/to v0.4.0
go: downloading github.com/Azure/go-autorest/autorest v0.11.20
go: downloading github.com/Azure/go-autorest/autorest/validation v0.3.1
go: downloading github.com/Azure/go-autorest/tracing v0.6.0
go: downloading github.com/Azure/go-autorest/logger v0.2.1
go: downloading github.com/Azure/go-autorest/autorest/adal v0.9.13
go: downloading github.com/Azure/go-autorest/autorest/azure/auth v0.5.8
go: downloading github.com/Azure/go-autorest/autorest/adal v0.9.15
go: downloading github.com/Azure/go-autorest/autorest/azure/cli v0.4.2
go: downloading github.com/Azure/go-autorest/autorest/azure/cli v0.4.3
go: downloading github.com/Azure/azure-sdk-for-go v0.2.0-beta
github.com/Azure/azure-sdk-for-go/sdk/armcore imports
github.com/Azure/azure-sdk-for-go/sdk/internal/runtime: cannot find module providing package github.com/Azure/azure-sdk-for-go/sdk/internal/runtime

Just updating to mention I can see it in a branch only

[https://github.com/Azure/azure-sdk-for-go/blob/7d922f1ae7f000c2b6a7360503500a252fc962a2/sdk/internal/runtime/frame_error.go#L17]

It affects individual downloads of azcore too

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Aug 26, 2021
@RickWinter RickWinter added Azure.Core bug This issue requires a change to an existing behavior in the product in order to be resolved. labels Aug 26, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 26, 2021
@RickWinter RickWinter added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Aug 26, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 26, 2021
@RickWinter RickWinter added this to the [2021] September milestone Aug 26, 2021
@jhendrixMSFT
Copy link
Member

Unfortunately this is due to mixing of module/no-module code.

Our SDK is split into two buckets. Our current SDK, which we call track 1, is all the content under the /services and /profiles directories. It is not authored as a Go module.
Our vNext SDK, which we call track 2, is all the content under the /sdk directory. All of this content is released as Go modules.

The problem here is that when you go get github.com/Azure/azure-sdk-for-go you're pulling down track 1 and track 2 simultaneously. And since track 1 is not a module, you end up getting track 2 content at various stages of development.

We have an issue tracking the conversion of track 1 to a Go module here but there is cost associated with this change. Until this is sorted out I fear that this problem will surface from time to time.

At any rate, the offending module has been deleted in #15388, so in the future this should not happen.

@RickWinter RickWinter added the EngSys This issue is impacting the engineering system. label Aug 26, 2021
@abelal83
Copy link

abelal83 commented Aug 31, 2021

I'm facing this exact same issue today, various modules have this

PS C:\src\github\abx\demo> go get github.com/Azure/azure-sdk-for-go/sdk/cosmos/armcosmos
go: downloading github.com/Azure/azure-sdk-for-go/sdk/cosmos/armcosmos v0.1.0
github.com/Azure/azure-sdk-for-go/sdk/cosmos/armcosmos imports
        github.com/Azure/azure-sdk-for-go/sdk/armcore imports
        github.com/Azure/azure-sdk-for-go/sdk/internal/runtime: cannot find module providing package github.com/Azure/azure-sdk-for-go/sdk/internal/runtime

and

PS C:\src\github\abx\demo> go get github.com/Azure/azure-sdk-for-go/sdk/resources/armresources
github.com/Azure/azure-sdk-for-go/sdk/resources/armresources imports
        github.com/Azure/azure-sdk-for-go/sdk/armcore imports
        github.com/Azure/azure-sdk-for-go/sdk/internal/runtime: cannot find module providing package github.com/Azure/azure-sdk-for-go/sdk/internal/runtime

These are the only ones I've tested but could happen with more.

@jhendrixMSFT
Copy link
Member

@abelal83 do you see this when creating a new app, or is there more to it? I'm guessing the latter as it works for me with a new app, but maybe I'm missing something (my repro is with Go 1.17).

PS C:\git\jhendrixMSFT\armdemo> go mod init armdemo
go: creating new go.mod: module armdemo
PS C:\git\jhendrixMSFT\armdemo> go get github.com/Azure/azure-sdk-for-go/sdk/cosmos/armcosmos
go: downloading github.com/Azure/azure-sdk-for-go/sdk/cosmos/armcosmos v0.1.0
go get: added github.com/Azure/azure-sdk-for-go v56.1.0+incompatible
go get: added github.com/Azure/azure-sdk-for-go/sdk/armcore v0.8.0
go get: added github.com/Azure/azure-sdk-for-go/sdk/azcore v0.16.2
go get: added github.com/Azure/azure-sdk-for-go/sdk/cosmos/armcosmos v0.1.0
go get: added github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.1
go get: added golang.org/x/net v0.0.0-20201010224723-4f7140c49acb
go get: added golang.org/x/text v0.3.3
PS C:\git\jhendrixMSFT\armdemo>

@abelal83
Copy link

Yup brand new app,

go version go1.17 windows/amd64

I see the same result as you

PS C:\src\github\abelal83\test> go mod init armdemo
go: creating new go.mod: module armdemo
PS C:\src\github\abelal83\test> go get github.com/Azure/azure-sdk-for-go/sdk/cosmos/armcosmos
go: downloading github.com/Azure/azure-sdk-for-go v56.1.0+incompatible
go: downloading golang.org/x/net v0.0.0-20201010224723-4f7140c49acb
go get: added github.com/Azure/azure-sdk-for-go v56.1.0+incompatible
go get: added github.com/Azure/azure-sdk-for-go/sdk/armcore v0.8.0
go get: added github.com/Azure/azure-sdk-for-go/sdk/azcore v0.16.2
go get: added github.com/Azure/azure-sdk-for-go/sdk/cosmos/armcosmos v0.1.0
go get: added github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.1        
go get: added golang.org/x/net v0.0.0-20201010224723-4f7140c49acb
go get: added golang.org/x/text v0.3.3

However, the issue arises when I use with other imports

package main

import (
	"fmt"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/cosmos/armcosmos" 
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		fmt.Print(err)
		return
	}
	fmt.Print(cred)
	con := arm.NewDefaultConnection(cred, nil)
	fmt.Print(con)

	client := armcosmos.NewDatabaseClient(con, "xyz")
}

The error I get in VS Code is

error while importing github.com/Azure/azure-sdk-for-go/sdk/cosmos/armcosmos: cannot find module providing package github.com/Azure/azure-sdk-for-go/sdk/internal/runtime: import lookup disabled by -mod=readonly

The other 2 packages import and work just fine.

@jhendrixMSFT
Copy link
Member

Ah I see. We're in the middle of refactoring the azcore module and the SDKs (e.g. armcosmos) haven't caught up yet. This "catching up" will happen this week. In the meantime, here's what you need to do to get unblocked.

  • Use azcore@v0.16.2
  • Use armcore@v0.8.0 in lieu of azcore/arm (armcore has been merged into azcore/arm starting with v0.19.0)
  • Use azidentity@v0.9.2

We'll also be updating our docs/samples as part of the refresh to reference the new packages.

@abelal83
Copy link

Thanks for this. It's late here but I'll be sure to give it a try tomorrow.

@abelal83
Copy link

abelal83 commented Sep 1, 2021

works perfectly now, thank you @jhendrixMSFT.

@RickWinter RickWinter added the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Sep 8, 2021
@ghost
Copy link

ghost commented Sep 8, 2021

Hi @adeturner. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

1 similar comment
@ghost
Copy link

ghost commented Sep 8, 2021

Hi @adeturner. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

@adeturner
Copy link
Author

Thanks

@adeturner
Copy link
Author

adeturner commented Sep 12, 2021

Apologies, I had to reopen this; whilst the original issue is fixed (go get everything) the latest build is still problematic for me. Is there an easy workaround? Starting with an empty cache...

$ mkdir ade; cd ade
$ go mod init
go: creating new go.mod: module ade

$ cat > ade.go
package ade

import (
        "github.com/Azure/azure-sdk-for-go/sdk/armservicebus"
        "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
        "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
)

func NewAzServiceBusTest(sbNamespace, queueName string) (asb *AzServiceBus, err error) {
        cred, err := azidentity.NewDefaultAzureCredential(nil)
        con := arm.NewDefaultConnection(cred, nil)
        client := armservicebus.NewSubscriptionsClient(con, "<subscription ID>")
        fmt.Println(fmt.Sprintf("%v", client))
}

$ go mod tidy
go: finding module for package github.com/Azure/azure-sdk-for-go/sdk/azidentity
go: finding module for package github.com/Azure/azure-sdk-for-go/sdk/armservicebus
go: finding module for package github.com/Azure/azure-sdk-for-go/sdk/azcore/arm
go: downloading github.com/Azure/azure-sdk-for-go v0.2.0-beta
go: downloading github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0
go: downloading github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0
go: downloading github.com/Azure/azure-sdk-for-go v57.2.0+incompatible
go: found github.com/Azure/azure-sdk-for-go/sdk/azcore/arm in github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0
go: found github.com/Azure/azure-sdk-for-go/sdk/azidentity in github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0
go: downloading github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0
go: finding module for package github.com/Azure/azure-sdk-for-go/sdk/armservicebus
ade imports
        github.com/Azure/azure-sdk-for-go/sdk/armservicebus: module github.com/Azure/azure-sdk-for-go@latest found (v57.2.0+incompatible), but does not contain package github.com/Azure/azure-sdk-for-go/sdk/armservicebus

Its quite hard to understand all the versions, releases and dependencies between the two tracks and for each module; what should and shouldnt be working. Is this documented/coded somewhere?

@adeturner adeturner reopened this Sep 12, 2021
@RickWinter RickWinter removed the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Sep 13, 2021
@jhendrixMSFT
Copy link
Member

I think the problem here is that your path to armservicebus is incorrect. It should be github.com/Azure/azure-sdk-for-go/sdk/servicebus/armservicebus

See https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/servicebus/armservicebus

@adeturner
Copy link
Author

Thanks Joel... I did get it working but forgot to update. I'll be honest, I didn't really understand how to use the servicebus library so gave up and wrapped az cli to get the job done, and then azure-service-bus-go for the client+topic/sub building.

If there is any documentation or samples that explains how to use the auto-generated APIs with a local service principal I've love to see it. That said, even for azure-service-bus-go I mostly had to read the code to work it out...

@sundowndev
Copy link

Hi, I have the same issue with package github.com/Azure/azure-sdk-for-go/sdk/resources/armresources.

$ go get github.com/Azure/azure-sdk-for-go/sdk/resources/armresources@v0.3.0 
go get: upgraded github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.9.2 => v0.10.0
go get: added github.com/Azure/azure-sdk-for-go/sdk/resources/armresources v0.3.0

$ go run main.go
../../../go/pkg/mod/github.com/!azure/azure-sdk-for-go/sdk/armcore@v0.8.0/policy_register_rp.go:19:2: no required module provides package github.com/Azure/azure-sdk-for-go/sdk/internal/runtime; to add it:
	go get github.com/Azure/azure-sdk-for-go/sdk/internal/runtime

I don't get why the error is about github.com/!azure/azure-sdk-for-go/sdk/armcore but it only happens when importing armresources. Is there a workaround for this ?

@eliecharra
Copy link

github.com/!azure/azure-sdk-for-go/sdk/armcore

It seems that it worked by removing armcore and use azcore/arm instead. I also have to update armstorage to be able to pass azcore.arm.Connection to client constructor

@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. EngSys This issue is impacting the engineering system.
Projects
None yet
Development

No branches or pull requests

6 participants