go get with vanity import path and 404: fails

86 views
Skip to first unread message

Dan Kortschak

unread,
Jun 20, 2020, 7:38:03 PM6/20/20
to golang-nuts
Yesterday we replaced the old gonum.org site with a new hugo build.
This appears to have broken go get for clients that do not use
proxy.golang.org or some other proxy that already has gonum.org/...
cached (this includes gddo).

```
$ GOPROXY=direct go get gonum.org/v1/gonum
go get gonum.org/v1/gonum: unrecognized import path
"gonum.org/v1/gonum": reading https://gonum.org/v1/gonum?go-get=1: 404
Not Found
```

It was my understanding that go get should examine go get meta tags
even if the page returns a 404 (though looking at our old site there is
a static 404 page included to work around this it seems). Is this not
correct? If it's not correct, what is the appropriate technique to
provide this information to go get for pages that are not serving
anything other than go get metadata?

thanks
Dan

ref:https://github.com/gonum/website/issues/9


Tim Heckman

unread,
Jun 20, 2020, 9:10:21 PM6/20/20
to golang-nuts
Closing the loop on this. They reached out in the Gopher Slack and we pieced it together:


It has to do with this section of code:


This chooses to swallow parsing errors if the HTTP response looks to be invalid (bad status code), which is what's happening here. Another user managed to find that the meta tags on the page look malformed:

<meta name=go-import content="gonum.org/v1/exp git https://github.com/gonum/exp">

Notice that go-import is missing quotes around it. I think fixing those up should solve the issue here. There is a larger question as to whether this code should return both, as it's hard to know which is correct and in this case it shared the wrong context.

Cheers!
-Tim

Dan Kortschak

unread,
Jun 20, 2020, 11:24:33 PM6/20/20
to Tim Heckman, golang-nuts
Thanks to Tim and Eric Bajumpaa on slack.

The issue was due to an error in minification where the quotes around
the name attribute value are stripped. Turning off minification is an
interim workaround while that is broken.

Dan

Dan Kortschak

unread,
Jun 21, 2020, 11:22:41 PM6/21/20
to Tim Heckman, golang-nuts
As a follow-up to the follow-up, I have filed golang.org/issue/39748;
the error is apparently not in minification, but in the go command's
handling of html. The workaround remains the same.
Reply all
Reply to author
Forward
0 new messages