简体   繁体   English

如何调查/修复:模糊导入:在多个模块中找到 package cloud.google.com/go/compute/metadata

[英]How to investigate/fix: ambiguous import: found package cloud.google.com/go/compute/metadata in multiple modules

When I do a go mod tidy (go v1.19), I am receiving the following error.当我执行 go mod tidy (go v1.19) 时,我收到以下错误。 I do see both packages in my go pkg directory.我确实在我的 go pkg 目录中看到了这两个包。 I assume that v1.6.1 is the most current version and is the one to keep.我假设 v1.6.1 是最新版本并且是要保留的版本。 If this is true, how do I determine who is dragging in the older v0.34.0 version and correct it?如果这是真的,我如何确定谁在拖入旧的 v0.34.0 版本并更正它? I'd appreciate your suggestions.我会很感激你的建议。

Thank you for your time and interest, Mike谢谢你的时间和兴趣,迈克

github.com/abc/runimage/v5/core/service imports
    github.com/grpc-ecosystem/go-grpc-middleware/auth tested by
    github.com/grpc-ecosystem/go-grpc-middleware/auth.test imports
    google.golang.org/grpc/credentials/oauth imports
    golang.org/x/oauth2/google imports
    cloud.google.com/go/compute/metadata: ambiguous import: found package cloud.google.com/go/compute/metadata in multiple modules:
    cloud.google.com/go v0.34.0 (/Users/mike/Go/pkg/mod/cloud.google.com/go@v0.34.0/compute/metadata)
    cloud.google.com/go/compute v1.6.1 (/Users/mike/Go/pkg/mod/cloud.google.com/go/compute@v1.6.1/metadata)
make: *** [tidy] Error 1
// go.mod 

module github.com/abc/runimage/v5

go 1.19

require (
    github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
    github.com/labstack/gommon v0.3.1
    google.golang.org/genproto v0.0.0-20220805133916-01dd62135a58
    google.golang.org/grpc v1.48.0
    google.golang.org/protobuf v1.28.1
)

require (
    github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.2
    github.com/joho/godotenv v1.4.0
)

require (
    github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d // indirect
    github.com/go-resty/resty/v2 v2.7.0 // indirect
    github.com/goccy/go-json v0.9.4 // indirect
    github.com/golang/protobuf v1.5.2 // indirect
    github.com/hashicorp/errwrap v1.0.0 // indirect
    github.com/hashicorp/go-multierror v1.1.1 // indirect
    github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
    github.com/lestrrat-go/blackmagic v1.0.0 // indirect
    github.com/lestrrat-go/httpcc v1.0.0 // indirect
    github.com/lestrrat-go/iter v1.0.1 // indirect
    github.com/lestrrat-go/jwx v1.2.18 // indirect
    github.com/lestrrat-go/option v1.0.0 // indirect
    github.com/mattn/go-colorable v0.1.12 // indirect
    github.com/mattn/go-isatty v0.0.14 // indirect
    github.com/okta/okta-jwt-verifier-golang v1.3.1 // indirect
    github.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627 // indirect
    github.com/pkg/errors v0.9.1 // indirect
    github.com/valyala/bytebufferpool v1.0.0 // indirect
    github.com/valyala/fasttemplate v1.2.1 // indirect
    golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
    golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e // indirect
    golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d // indirect
    golang.org/x/text v0.3.7 // indirect
)

Try go get cloud.google.com/go/compute/metadata and then go mod tidy尝试go get cloud.google.com/go/compute/metadata然后go mod tidy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Cloud Composer 中导入自定义模块 - how to import custom modules in Cloud Composer 如何将 Python 包添加到 Google Cloud Composer - How to add a Python package to Google Cloud Composer 如何将 Google Cloud 凭据导入 Firebase Cloud Function? - How to import Google Cloud credentials into a Firebase Cloud Function? 谷歌云计算是否存在数据使用限制 - Are there data usage limitations with Google Cloud Compute 谷歌云的 glcoud 计算实例创建给出错误“找不到资源项目/{ourID}/global/images/family/debian-8 - Google cloud's glcoud compute instance create gives error "The resource projects/{ourID}/global/images/family/debian-8 was not found 如何在 Google Cloud Compute Engine 实例上轮换临时 IP? - How do I rotate ephemeral IP on Google Cloud Compute Engine instance? 如何在 Google Cloud Storage 中下载多个文件 - How to download multiple files in Google Cloud Storage 如何将 Cloud Composer 与计算引擎集成 - How to integrate cloud composer with compute Engine 如何将 Google Cloud 项目所有权从 MyEmail@mydomain.com 转移到 myemail@mydomain.com? - How to transfer Google Cloud project ownership from MyEmail@mydomain.com to myemail@mydomain.com? 无法 SSH 进入我在 Google Cloud 上的 Compute Engine 虚拟机实例 - Unable to SSH into my Compute Engine VM instance on Google Cloud
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM