DEV Community

Yoshi Yamaguchi
Yoshi Yamaguchi

Posted on • Updated on

Search Go packages from navigation bar

Find the package

Go team recently announced the new package search system, pkg.go.dev, will take over the search on godoc.org.

It is often the case to use browsers for searching Go package on Google and godoc.org, but it seems it's time to create the shortcut for pkg.go.dev as the engineer who uses Go for daily basis. However, typing "pkg.go.dev" in the browser navigation takes some time and we'd like to reduce the typing effort if we can. So, let's do it!

In Google Chrome, there's a setting for search engine, and there's a section titled "Manage search engines", where you can set up arbitrary URLs for querying something.

Search engine setting

You may already have a bunch of search engines registered, and here you can add another one for pkg.go.dev as the following:

Add search engine

In this dialog, you need to put 3 settings, and especially important ones are "Keyword" and "Query URL".

"Query URL" is straightforward. This is the URL template when you query anything with the search engine, and you can specify %s as the placeholder for the query parameters or path name. In the case of pkg.go.dev, the value is https://pkg.go.dev/search?q=%s.

"Keyword" is what makes your productivity awesome. This is the shortcut name you want to type in the navigation bar of Google Chrome. With the combination of "keyword" and tab key, you can trigger the search engine. For instance, I used pkg for the trigger keyword of pkg.go.dev, so if you type pkg in the navigation bar and press tab key, then you'll see the following notation on the left side of the navigation bar:

Keyword triggering

In that status, now you can type in Go package name you are looking for, such as go.opentelemetry.io, then hit enter key. You can just type in a part of package names as well such as error and so on.

Search result

Here you go! Now it got much easier to find package from the browser.

Photo credit is by https://www.thewritingreader.com/blog/2017/11/22/prompt-4079-so-many-packages/

Top comments (0)