Vanity Imports in Golang

The imports in Golang are the fullpath of the package including the domain name. It is common to host the packages on Github and use it for import as well. However, there are two problems with it.

The two aforementioned problems can be solved using vanity imports in Go. What vanity import means is using a custom domain for package imports.

github.com/<username>/<repository>/pkg/<xyz> -> <user.tld>/xyz

There are few ways to do it, but all essentially boil down to adding meta tags in the response which go command can parse to figure out where is the actual code located. I am thinking of building a system to easily generate static files as part of #weekend #projects