gpt4 book ai didi

go - 意外的模块路径 go-modules

转载 作者:IT王子 更新时间:2023-10-29 02:00:41 26 4
gpt4 key购买 nike

我在 Github 上有一个存储库,其中仅包含一些 Go 结构,可在我的整个服务中用作模型。

https://github.com/pocockn/models

然后我想将其导入到我的服务中,我在两个存储库中都使用了 Go Modules。当我在我的服务中运行“go get”时,出现以下错误。

go: finding github.com/pocockn/models/api/football latestgo: finding github.com/pocockn/models/api latest go: finding github.com/pocockn/models latest go: github.com/pocockn/models@v0.0.0-20190511152220-d7675ec24338: parsing go.mod: unexpected module path "models"

模型库中的 go.mod 文件如下所示

module models

go 1.12

require github.com/jinzhu/gorm v1.9.8

最佳答案

go.mod 中的模块名称应该是 github.com/pocockn/models,与 repo 路径匹配。它也可以是自定义域/路径,假设该域具有托管代码或正确的 header 以重定向到您的存储库(使用类似 https://github.com/GoogleCloudPlatform/govanityurls 的东西)。

(看起来你可能已经这样做了。如果其他人发现这个问题,请在这里回答。)

关于go - 意外的模块路径 go-modules,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56091744/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com