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: hang in 'go get golang.org/x/tools/cmd/godoc' in GOPATH mode #34821

Closed
deepnum opened this issue Oct 10, 2019 · 9 comments

Comments

@deepnum
Copy link

commented Oct 10, 2019

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

$ go version
1.13

Does this issue reproduce with 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/tanvir/.cache/go-build"
GOENV="/home/tanvir/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/tanvir/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build911798959=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go get golang.org/x/tools/cmd/godoc

it does not do any thing.

What did you expect to see?

install godoc

What did you see instead?

a blank cursor on ternmnal and it hang, doesn't stop

@deepnum

This comment has been minimized.

Copy link
Author

commented Oct 10, 2019

it only create the directory but don't download the code

.
└── golang.org
    └── x
        └── tools

@bcmills

This comment has been minimized.

Copy link
Member

commented Oct 10, 2019

Could be a connectivity issue to proxy.golang.org.

What happens if you run curl -sL https://proxy.golang.org/golang.org/x/tools/@latest?

@bcmills

This comment has been minimized.

Copy link
Member

commented Oct 10, 2019

For go command hangs, please provide the following additional information:

  • Run the pstree command with the PID of the go process as its argument.
  • Run kill -QUIT on the go process.

Post the results of both in a <details>[…]</details> block.

@deepnum

This comment has been minimized.

Copy link
Author

commented Oct 10, 2019

$ ps
  PID TTY          TIME CMD
16471 pts/0    00:00:00 bash
16515 pts/0    00:00:00 lf
16570 pts/0    00:00:00 go
16584 pts/0    00:00:00 git
16585 pts/0    00:00:00 git-remote-http
16675 pts/0    00:00:00 ps
$ pstree 16570
go─┬─git───git-remote-http
   └─11*[{go}]

$ kill -QUIT 16570 
$ 


@deepnum

This comment has been minimized.

Copy link
Author

commented Oct 10, 2019

$ go get golang.org/x/tools/cmd/godoc
package golang.org/x/tools/cmd/godoc: unrecognized import path "golang.org/x/tools/cmd/godoc" (https fetch: Get https://golang.org/x/tools/cmd/godoc?go-get=1: dial tcp [2404:6800:4007:80b::2011]:443: connect: network is unreachable)
@deepnum

This comment has been minimized.

Copy link
Author

commented Oct 10, 2019

$ curl -sL https://proxy.golang.org/golang.org/x/tools/@latest?
{"Version":"v0.0.0-20191010075000-0337d82405ff","Time":"2019-10-10T07:50:00Z"}
@bcmills

This comment has been minimized.

Copy link
Member

commented Oct 10, 2019

In the go env output you provided, I see:

GOPROXY="https://proxy.golang.org,direct"

We've confirmed that you're able to fetch from proxy.golang.org. So why is the go command falling back to a direct fetch from https://golang.org/x/tools/cmd/godoc?go-get=1?

Please try the -x flag (as in go get -x golang.org/x/tools/cmd/godoc) and attach the result. (It will be pretty verbose, but maybe it will give us a clue.)

@bcmills bcmills changed the title go get not working cmd/go: hang in 'go get golang.org/x/tools/cmd/godoc' Oct 10, 2019
@bcmills

This comment has been minimized.

Copy link
Member

commented Oct 10, 2019

Oh, wait, here's the other important clue! From go env:

GOMOD=""

That implies that you are fetching in GOPATH mode, not module mode.

So this looks like:

  1. For some reason you have a connectivity issue to https://golang.org but not to https://proxy.golang.org.
  2. Because your go get command is running in GOPATH mode, it is not using the proxy.

If you just want to install the godoc tool (and not clone its repo into GOPATH/src), the simple workaround is to enable module mode explicitly:

$ GO111MODULE=on go get golang.org/x/tools/cmd/godoc
@bcmills bcmills changed the title cmd/go: hang in 'go get golang.org/x/tools/cmd/godoc' cmd/go: hang in 'go get golang.org/x/tools/cmd/godoc' in GOPATH mode Oct 10, 2019
@deepnum deepnum closed this Oct 11, 2019
@deepnum

This comment has been minimized.

Copy link
Author

commented Oct 11, 2019

it works

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