Can't find bitbucket packages in golang migration (go modules)

606 views Asked by At

I'm updating a google app engine app so it uses golang 1.12.

I'm forced to use go modules. Because of that I'm trying to modify the proyect to do so. I updated to .yml file to reflect that:

runtime: go112
...
- url: /.*
  script: auto

Since I'm not the original dev, I'm having issue with getting it working. It's using a private bitbucket. I'm auth with ssh keys so golang can fetch the packages when it invokes git correctly.

I'm still having an issue while running '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()
}

tree -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
1

There are 1 answers

0
bcmills On

Some source file within your package contains a statement like import "bitbucket.org/nxtlab/sticktothebrand/access".

Your tree output indicates that there is no ./access subdirectory, so that package does not exist in the main module. The go command is trying to find it in another module, but given your module path I suspect that no other viable module exists.

To fix go mod tidy, you need to find and remove the erroneous import statement.