在golang迁移中找不到bitbucket软件包进入模块

问题描述

我正在更新一个Google App Engine应用程序,以便它使用golang 1.12。

我被迫使用go模块。因此,我正在尝试修改proyect。 我更新为.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"

go.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 语句。