go - 在 golang 迁移中找不到 bitbucket 包(go modules)
问题描述
我正在更新一个谷歌应用引擎应用,所以它使用 golang 1.12。
我被迫使用 go 模块。因此,我正在尝试修改项目来这样做。我更新到 .yml 文件以反映这一点:
runtime: go112
...
- url: /.*
script: auto
由于我不是原始开发人员,因此我无法使其正常工作。它使用私人比特桶。我使用 ssh 密钥进行身份验证,因此 golang 可以在正确调用 git 时获取包。
运行“go mod tidy”时我仍然遇到问题:
bitbucket.org/nxtlab/sticktothebrand/app imports
bitbucket.org/nxtlab/sticktothebrand: cannot find module providing package bitbucket.org/nxtlab/sticktothebrand: invalid bitbucket.org/ import path "bitbucket.org/nxtlab"
bitbucket.org/nxtlab/sticktothebrand/gopath/src/bitbucket.org/nxtlab/sticktothebrand imports
bitbucket.org/nxtlab/sticktothebrand/access: no matching versions for query "latest"
去.mod:
module bitbucket.org/nxtlab/sticktothebrand
go 1.12
require (
# Other none bitbucket related packages
)
./app/main.go:
package main
import (
"bitbucket.org/nxtlab/sticktothebrand"
)
func init() {
sticktothebrand.Run()
}
树-L 2:
├── Makefile
├── app
│ ├── acl.json
│ ├── app.dev.yaml
│ ├── app.prod.yaml
│ ├── app.test.yaml
│ ├── blocks
│ ├── index.yaml
│ ├── main.go
│ ├── manager -> ../manager/dist/
│ └── static
├── docker
│ ├── Dockerfile
│ ├── go.sh
│ └── run.sh
├── go.mod
├── go.sum
├── gopath
│ └── src
├── manager
│ ├── bower.json
│ ├── config.beta.json
│ ├── config.dev.json
│ ├── config.test.json
│ ├── dist
│ ├── e2e
│ ├── gulp
│ ├── gulpfile.js
│ ├── karma.conf.js
│ ├── package.json
│ ├── protractor.conf.js
│ └── src
├── project
│ └── vval2016
└── research
├── Screen Shot 2015-09-10 at 11.29.14.png
├── Screen Shot 2015-09-10 at 11.30.29.png
├── Screen Shot 2015-09-10 at 11.30.55.png
├── Screen Shot 2015-09-10 at 11.31.29.png
├── Screen Shot 2015-09-10 at 11.31.34.png
└── Screen Shot 2015-09-10 at 11.32.40.png
解决方案
包中的某些源文件包含类似import "bitbucket.org/nxtlab/sticktothebrand/access"
.
您的tree
输出表明没有./access
子目录,因此主模块中不存在该包。该go
命令试图在另一个模块中找到它,但鉴于您的模块路径,我怀疑不存在其他可行的模块。
要修复go mod tidy
,您需要找到并删除错误的import
语句。
推荐阅读
- python-3.x - boto3 用于 cloudtrail 查找事件
- sql - 如何选择唯一条目
- c++ - BOOST::GIL color_converted_view 无法编译
- r - 具有缺失值的 Cronbachs Alpha
- paraview - 如何在视图之间链接 paraview 过滤器详细信息?
- ecmascript-6 - 用 jest 测试重复的 observable
- java - 在 AWS S3 Bucket Spring Boot 中上传图像的验证
- python - 如何在 python 中使用 lambda 函数获取完整的数据帧?
- javascript - 如何在CKEditor 5中用空格替换新行
- drupal - Drupal:找不到请求的页面