go get not downloading a module under a repository from BitBucket

357 views
Skip to first unread message

Dean Schulze

unread,
Nov 7, 2020, 8:34:15 PM11/7/20
to golang-nuts
In my git repo (bitbucket.org) I have

reponame/
.git/
integration1/
integration2/
integration-common/
└── util
    ├── go.mod
    └── readascii.go

The module directory is a subdirectory of the git repository.  The repository is tagged with v0.0.1.

Heres the go.mod

go 1.14

When I do a go get for this module I get the following error:

go: downloading bitbucket.org/orgname/reponame v0.0.1

I can see the integration-common/util/ directory in bitbucket under the tag v0.0.1 if I look with the web browser.  The go.mod has the contents shown above.

What is even more odd is that go get does manage to download the other directories in the repository (integration1 and integration2).  For some reason it thinks v0.0.1 doesn't contain the integration-common/ directory, even though bitbucket shows it there for that tag.

I have to use ssh instead of https because our private repos on bitbucket.org require 2fa.  I have this in my ~/.gitconfig:



I know bitbucket is weird when it comes to using go get.  Is there something I missed, or is the a bug with go get and bitbucket?

seank...@gmail.com

unread,
Nov 8, 2020, 4:04:42 PM11/8/20
to golang-nuts
https://golang.org/ref/mod#vcs-version 3rd paragraph

> If a module is defined in a subdirectory within the repository, that is, the module subdirectory portion of the module path is not empty, then each tag name must be prefixed with the module subdirectory, followed by a slash. For example, the module golang.org/x/tools/gopls is defined in the gopls subdirectory of the repository with root path golang.org/x/tools. The version v0.4.0 of that module must have the tag named gopls/v0.4.0 in that repository.

Dean Schulze

unread,
Nov 8, 2020, 9:03:09 PM11/8/20
to golang-nuts
I created the tag

git tag integration-common/util/v0.0.1

and verified that it got pushed to bitbucket.  When I `go get` the tag it shows


but nothing gets downloaded.  A silent failure.

I also tried this


but it returns immediately and does nothing.

Anderson Queiroz

unread,
Nov 10, 2020, 8:47:14 AM11/10/20
to golang-nuts
Not trying to doubt you, but are you sure it's a silent failure?

Where are you invoking `go get`? Is it running on module aware mode, being called within a go module?
Try to run go get with "-v" to see if you get more information about what is happening.
Reply all
Reply to author
Forward
0 new messages