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: go get -u <respo>@<branch> update latest code a long time later #42576

Closed
maomaoguo2017 opened this issue Nov 13, 2020 · 4 comments
Closed

Comments

@maomaoguo2017
Copy link

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

$ go version
go version go1.14.6 darwin/amd64

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/gattaca/Library/Caches/go-build"
GOENV="/Users/gattaca/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/gattaca/git/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/gattaca/git/test-go-mod2/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/2j/qk1sjybs0_sf7gz030rkvm4h0000gn/T/go-build365705725=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

mod1 (main branch): github.com/maomaoguo2017/test-go-mod1
mod2 (main branch): github.com/maomaoguo2017/test-go-mod2
mod2 dependent mod1;

(mod2) mod.go

module github.com/maomaoguo2017/test-go-mod2

go 1.14

require github.com/maomaoguo2017/test-go-mod1 v0.0.3-0.20201112113544-07b048dab095

step1: mod1 merge branch "dev" into main (bfaf841) or just pull(62acd45);
step2: into mod2 and input

go get -v -u github.com/maomaoguo2017/test-go-mod1@main
<nothing output>

i expect mod1 version in go.mod of mod2 will update to latest but nothing to happen...

after "go get -u github.com/maomaoguo2017/test-go-mod1@main"
(mod2) mod.go

module github.com/maomaoguo2017/test-go-mod2

go 1.14

require github.com/maomaoguo2017/test-go-mod1 v0.0.3-0.20201112113544-07b048dab095

image

and when i run same command a long time later, it's ok.

go get -v -u github.com/maomaoguo2017/test-go-mod1@main
go: github.com/maomaoguo2017/test-go-mod1 main => v0.0.3-0.20201112125147-62acd45a2f00
go: downloading github.com/maomaoguo2017/test-go-mod1 v0.0.3-0.20201112125147-62acd45a2f00

Why??

@bcmills
Copy link
Contributor

bcmills commented Nov 13, 2020

By default, the go command uses GOPROXY="https://proxy.golang.org,direct" (and note that line in the go env output you pasted).

proxy.golang.org has a fairly long cache TTL for the mapping of branch-names to commits.

@bcmills
Copy link
Contributor

bcmills commented Nov 13, 2020

Duplicate of #38065

@bcmills bcmills marked this as a duplicate of #38065 Nov 13, 2020
@bcmills bcmills closed this as completed Nov 13, 2020
@maomaoguo2017
Copy link
Author

By default, the go command uses GOPROXY="https://proxy.golang.org,direct" (and note that line in the go env output you pasted).

proxy.golang.org has a fairly long cache TTL for the mapping of branch-names to commits.

OK, thanks for your time. ^_^

@maomaoguo2017
Copy link
Author

if respo is private 'go get [-u]' is ok, i guess private is auto use 'GOPROXY=direct'.

if respo is public of myself, can use 'GOPROXY=direct' safety

GOPROXY=direct go get -u github.com/maomaoguo2017/test-go-mod1@main

@golang golang locked and limited conversation to collaborators Nov 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants