Skip to content

Document how using a specific branch of a repo with go modules interacts with multi-module repos #30851

Closed
@grantwwu

Description

@grantwwu

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

$ go version
go version go1.12 darwin/amd64

Does this issue reproduce with the latest release?

I believe 1.12 is the latest release

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/grant.wu/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/grant.wu/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rm/k4qc6x917tdf1ms2f8t2jw1h0000gp/T/go-build926919438=/tmp/go-build -gno-record-gcc-switches -fno-common"

Description

(I'm not following the bug template here because this is more of a documentation issue)

It's not clear how using a multi-module (or single-module-with-go.mod-not-at-vcs-root) repo interacts with trying to get a particular branch.

Noting that the wiki says:

To upgrade or downgrade to a more specific version, 'go get' allows version selection to be overridden by adding an @Version suffix or "module query" to the package argument, such as go get foo@v1.6.2, go get foo@e3702bed2, or go get foo@'<v1.6.2'.

(https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies)

it's not immediately obvious to me how this interacts with multi-module repos, which require prepending the path. i.e. if I do go get foo@bar/baz/quux, does Go think that I'm trying to get a module rooted at /bar/baz, using the branch quux, or the module rooted at /bar on branch baz/quux?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions