frontend: Use Cloud search for Go import badges
Created by: tsenart
This commit fixes our Go import badges on sourcegraph.com, which have been broken since api.godoc.org was brought down. There's a tracking issue to re-introduce an API for pkg.go.dev, but it's not implemented yet.
Instead, we implement a best-effort alternative that relies on searching go.mod
files for the given repo name on sourcegraph.com. Sometimes packages will have different canonical names than their repositories, and we don't handle that case.
There are many open-source projects that have a broken badge. After this lands, they will recover.
Tested locally by changing the target URL to sourcegraph.com rather than internal.Client.URL
.