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

502 for honnef.co/go/tools #1265

Closed
srenatus opened this issue May 5, 2022 · 8 comments
Closed

502 for honnef.co/go/tools #1265

srenatus opened this issue May 5, 2022 · 8 comments

Comments

@srenatus
Copy link

srenatus commented May 5, 2022

When bypassing the go proxy for a build, I've come across this:

go: google.golang.org/[email protected] requires
	google.golang.org/[email protected] requires
	honnef.co/go/[email protected]: unrecognized import path "honnef.co/go/tools": reading https://honnef.co/go/tools?go-get=1: 502 Bad Gateway

With the debugging instructions from #492, I find:

$ curl -v 'https://honnef.co/go/tools?go-get=1'
*   Trying 147.182.171.172:443...
* Connected to honnef.co (147.182.171.172) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=honnef.co
*  start date: Apr 26 11:03:44 2022 GMT
*  expire date: Jul 25 11:03:43 2022 GMT
*  subjectAltName: host "honnef.co" matched cert's "honnef.co"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7f9015811000)
> GET /go/tools?go-get=1 HTTP/2
> Host: honnef.co
> user-agent: curl/7.79.1
> accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 502
< server: nginx
< date: Thu, 05 May 2022 09:49:00 GMT
< content-type: text/html
< content-length: 150
<
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
* Connection #0 to host honnef.co left intact

Is there anything you can do about this, please?

@srenatus srenatus added the needs-triage Newly filed issue that needs triage label May 5, 2022
@gos-apoorv
Copy link

gos-apoorv commented May 5, 2022

Same issue persist for me today.

go: google.golang.org/[email protected] requires
	google.golang.org/[email protected] requires
	honnef.co/go/[email protected]: unrecognized import path "honnef.co/go/tools": reading https://honnef.co/go/tools?go-get=1: 502 Bad Gateway

Can you please help about it?

@bb-tb-navneet
Copy link

same issue for me , pls resolve it asap
thanks

@bb-tb-abhishek
Copy link

Please resolve this. Its Hampering image builds

@kaushiknag90
Copy link

Seeing this issue today and getting 502 gateway timeout error whole fetching dependency.

Failure fetching honnef.co/go/tools with 502 gateway timeout error. This is failing in local macbook and multiple Jenkins platforms as well.

Running grpcserver functional tests...
go: github.com/grpc-ecosystem/[email protected] requires
google.golang.org/[email protected] requires
honnef.co/go/[email protected]: unrecognized import path "honnef.co/go/tools": reading https://honnef.co/go/tools?go-get=1: 502 Bad Gateway
make: *** [grpcserver-functional-test] Error 1
grpc server functional test failed

Can you please help in resolving this as we are blocked due to this.

@tompreston
Copy link

tompreston commented May 5, 2022

I can reproduce in a fresh module with the GOPROXY disabled. I'm also seeing this in a repo managed with Dep, since it doesn't use the GOPROXY.

$ mkdir tmp-go && cd tmp-go
$ go mod init example.com/m
go: creating new go.mod: module example.com/m

$ GOPROXY=direct go get honnef.co/go/tools
go: unrecognized import path "honnef.co/go/tools": reading https://honnef.co/go/tools?go-get=1: 502 Bad Gateway

But it still works with the goproxy (default)

$ go env GOPROXY
https://proxy.golang.org,direct

$ go get honnef.co/go/tools
go: downloading honnef.co/go/tools v0.3.1
go: added honnef.co/go/tools v0.3.1

I can workaround using a replace directive, if that helps anyone:

$ cat go.mod
module example.com/m

go 1.18

require honnef.co/go/tools v0.3.1 // indirect

replace honnef.co/go/tools => github.com/dominikh/go-tools v0.3.1

$ GOPROXY=direct go get -d honnef.co/go/tools
go: downloading github.com/dominikh/go-tools v0.3.1

I do wonder if you're all bypassing the GOPROXY though. I believe it's there to prevent this exact problem.

Edit for Dep users: I still haven't worked around this with Dep. You'd think the source directive stands in for replace but name still needs to be valid. I think maybe proxying honnef.co like GOPROXY does might work...

@robbiev
Copy link

robbiev commented May 5, 2022

For dep users, the following workaround works for me on macOS

Add this to /etc/hosts

127.0.0.1 honnef.co

Create this file structure

$ tree
.
└── go
    └── tools
        └── index.html

index.html contains this

$ cat go/tools/index.html
<html>
  <head>
    <meta name="go-import" content="honnef.co/go/tools git https://github.com/dominikh/go-tools">
  </head>
</html>

Then run this from the top directory (the one with the go directory in it). This is assuming you have python 3 installed.

python -m http.server 80

And run the dep command again

@gat786
Copy link

gat786 commented May 5, 2022

@tompreston thank you my guy, your answer helped a lot. I was confused the whole time why is it happening suddenly.

@dominikh
Copy link
Owner

dominikh commented May 5, 2022

This should be fixed now. Sorry for the brief inconvenience.

@dominikh dominikh closed this as completed May 5, 2022
@dominikh dominikh added infrastructure and removed needs-triage Newly filed issue that needs triage labels May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants