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: modules unable to fetch from commit, only from release #29196

Closed
githubsands opened this issue Dec 12, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@githubsands
Copy link

commented Dec 12, 2018

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

$ go version
go version go1.11.2 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env


go version go1.11.2 darwin/amd64
CACSVML-17695:golang-money rvacek924$ go env
GOARCH="amd64"
GOBIN="/Users/rvacek924/go/bin"
GOCACHE="/Users/rvacek924/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/rvacek924/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.2/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/rvacek924/go/src/github.com/comcast/golang-money/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/80/hrg50_hj7fs7p7j6tgfbr2xm0000gn/T/go-build363767281=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

export GO111MODULE=on
go mod init
go mod download
go get github.com/githubsands/webpa-common@feature/webpa_money_decorator
go mod download

tried to build. could not find current dependencies. so checked what vendor would look like.

go mod vendor

vendor only has dependencies with last tag release 2 years ago, not current most commit. A tag has not been used in 2 years.

What did you expect to see?

Expected to fetch all necessary dependencies from and to be able to build my project.

What did you see instead?

I instead was unable to build my project. Latest objects are not found, I checked the vendor folder and saw that its pulling dependencies from the latest release (tag), not the latest commit - even after using go get

@ALTree ALTree changed the title Go modules unable to fetch from commit, only from release cmd/go: modules unable to fetch from commit, only from release Dec 12, 2018

@bcmills bcmills self-assigned this Dec 13, 2018

@bcmills bcmills added this to the Go1.12 milestone Dec 13, 2018

@bcmills

This comment has been minimized.

Copy link
Member

commented Dec 21, 2018

This seems to be working as designed using go1.12beta1. The go get step selects version v0.9.0-alpha.0.20181220234435-97b5b4f072f1, which is a pseudo-version corresponding to the latest commit on the feature/webpa_money_decorator branch, and go mod download downloads that version:

$ go mod init golang.org/issue/scratch
go: creating new go.mod: module golang.org/issue/scratch

$ go get github.com/githubsands/webpa-common@feature/webpa_money_decorator
go: finding github.com/githubsands/webpa-common feature/webpa_money_decorator
go: downloading github.com/githubsands/webpa-common v0.9.0-alpha.0.20181220234435-97b5b4f072f1
go: extracting github.com/githubsands/webpa-common v0.9.0-alpha.0.20181220234435-97b5b4f072f1
go: finding github.com/githubsands/webpa-common v0.9.0-alpha
go: downloading github.com/githubsands/webpa-common v0.9.0-alpha
go: extracting github.com/githubsands/webpa-common v0.9.0-alpha

$ go mod download -json
{
        "Path": "github.com/githubsands/webpa-common",
        "Version": "v0.9.0-alpha.0.20181220234435-97b5b4f072f1",
        "Info": "/tmp/tmp.7Y0VRDwfO8/_gopath/pkg/mod/cache/download/github.com/githubsands/webpa-common/@v/v0.9.0-alpha.0.20181220234435-97b5b4f072f1.info",
        "GoMod": "/tmp/tmp.7Y0VRDwfO8/_gopath/pkg/mod/cache/download/github.com/githubsands/webpa-common/@v/v0.9.0-alpha.0.20181220234435-97b5b4f072f1.mod",
        "Zip": "/tmp/tmp.7Y0VRDwfO8/_gopath/pkg/mod/cache/download/github.com/githubsands/webpa-common/@v/v0.9.0-alpha.0.20181220234435-97b5b4f072f1.zip",
        "Dir": "/tmp/tmp.7Y0VRDwfO8/_gopath/pkg/mod/github.com/githubsands/webpa-common@v0.9.0-alpha.0.20181220234435-97b5b4f072f1",
        "Sum": "h1:SH62ths8n1OaY/N/7/He9mey76Ax5UrNRsBblf0saa8=",
        "GoModSum": "h1:1AtBRfsyU4JE6mw4ebTlPQx2ixH4RNCl0fRcmFiHacg="
}

$ go mod vendor
go: no dependencies to vendor

There is a funny bit of extra noise about downloading github.com/githubsands/webpa-common v0.9.0-alpha, which is probably a symptom of #29121, but it doesn't seem to affect the final result.

Note that go mod vendor only vendors in the packages in the transitive import graph of your module: since you haven't described any source code in the module, I would expect the vendor directory to be empty.

@bcmills bcmills closed this Dec 21, 2018

@bcmills

This comment has been minimized.

Copy link
Member

commented Dec 21, 2018

Do note that go mod download only downloads the modules already in the dependencies of your module: if you want to ensure that you download the modules for all of your transitive dependencies, you'll probably need to run go mod tidy to pull them into the dependency graph first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.