Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: v2 module in sub-sub-directory cannot be found #38592

Closed
wilriker opened this issue Apr 22, 2020 · 3 comments
Closed

cmd/go: v2 module in sub-sub-directory cannot be found #38592

wilriker opened this issue Apr 22, 2020 · 3 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@wilriker
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.14.2 linux/amd64

Does this issue reproduce with the latest release?

It's the latest release.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/manuel/.cache/go-build"
GOENV="/home/manuel/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/manuel/workspace/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/manuel/Sync/3DP/github/execonmcode/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build711825841=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I tried to get the latest (and single) release of my module in the v2 sub-directory. The package itself already is in a sub-directory because the repo also contains implementations in other languages.

$ go get github.com/Duet3D/DSF-APIs/godsfapi/v2@v2.1.0

I can see that it is very uncommon to start the v2-releases at v2.1.0 but this is a port and I have to orient my versioning on upstream.

What did you expect to see?

That go.mod contains an entry

require github.com/Duet3D/DSF-APIs/godsfapi/v2 v2.1.0

What did you see instead?

Error message on command line

go get github.com/Duet3D/DSF-APIs/godsfapi/v2@v2.1.0: github.com/Duet3D/DSF-APIs/godsfapi/v2@v2.1.0: invalid version: unknown revision godsfapi/v2.1.0

I also tried

$ go get github.com/Duet3D/DSF-APIs/godsfapi@v2.1.0
go get github.com/Duet3D/DSF-APIs/godsfapi@v2.1.0: module github.com/Duet3D/DSF-APIs@v2.1.0 found (v2.1.0+incompatible), but does not contain package github.com/Duet3D/DSF-APIs/godsfapi

which does ignore that the module is located in a sub-directory.

Meanwhile it works if I remove the require from my go.mod and go get it. It will then though insert the following entry

require github.com/Duet3D/DSF-APIs/godsfapi/v2 v2.0.0-20200422123133-670706fea346

This even points at the correct commit at which tag v.2.1.0 is attached. But still that does not look correct.

@seankhliao
Copy link
Member

as described in the wiki here: https://github.com/golang/go/wiki/Modules#publishing-a-release ,
modules rooted in subdirectories need tags prefixed by subdir/ so your tags should be godsfapi/vX.Y.Z

@andybons andybons changed the title v2 module in sub-sub-directory cannot be found cmd/go: v2 module in sub-sub-directory cannot be found Apr 22, 2020
@andybons andybons added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 22, 2020
@andybons andybons added this to the Unplanned milestone Apr 22, 2020
@bcmills
Copy link
Contributor

bcmills commented Apr 22, 2020

@wilriker, is it possible that this was just a cached negative result for that version on proxy.golang.org?

It seems to be working fine for me now:

example.com$ go version
go version devel +79395c55 Wed Apr 22 08:04:58 2020 +0000 linux/amd64

example.com$ go mod init example.com
go: creating new go.mod: module example.com

example.com$ go get -d github.com/Duet3D/DSF-APIs/godsfapi/v2@v2.1.0
go: downloading github.com/Duet3D/DSF-APIs/godsfapi/v2 v2.1.0
go: downloading github.com/Duet3D/DSF-APIs v2.1.0+incompatible

example.com$ go list -m all
example.com
github.com/Duet3D/DSF-APIs/godsfapi/v2 v2.1.0
github.com/mitchellh/mapstructure v1.2.2

@bcmills bcmills added modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Apr 22, 2020
@wilriker
Copy link
Author

Thanks @seankhliao for pointing me to the right spot in the documentation. In my defense it was the first time I had released a /v2 version and also the first time using a sub-directory in the repo. ;-) Sorry for the RTFM-noise.

@bcmills I was actually even trying with GOPROXY=direct and got the same failure.
I managed to create the correct tag from my smartphone but wanted to check actual go get first before reporting back the expected success result. That's why you were able to successfully load it in the meantime.

Thanks again!

@golang golang locked and limited conversation to collaborators Apr 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants