getvain is a simple HTTP server that supports vanity import paths for "go gettable" packages and modules.


When an HTTP request includes parameter ?go-get=1, the getvain service responds with a "go-import" <meta> tag, instructing go get to check code out of a version control system.

By default, getvain helps go get find packages via fossil. Specifically, go get will receive a <meta> tag:

" fossil"

The default behavior can be modified with flags:

  -addr string
		listen on address, i.e. "localhost:8080"; if omitted, serve CGI
  -domain string
		domain where source code is found
  -strip uint
		strip text from start of path, i.e. -strip=1 to make /src/foo become repository foo
  -suffix string
		append suffix to repository name
  -v    verbose log
  -vcs string
		version control system (default "fossil")

CGI usage

When getvain is run as a CGI script, parameters can be placed in the cgi-bin file. For example, the equivalent of getvain -domain -strip 0 -v becomes

-strip 0

Example - Fossil Via CGI

If fossil is configured to serve multiple repositories over CGI, you may find go get requests failing. Configuring fossil to serve a "go-import" meta tag can solve the problem, but may be difficult to configure for nested packages (i.e. go get Instead of configuring fossil to serve the <meta> tag, consider wrapping the fossil CGI script in a conditional script:

# while not ideal to launch this script process with every request, we'd be launching fossil anyway...
if [ "$QUERY_STRING" = "go-get=1" ]

The result is that getvain serves requests from go get, while fossil serves other requests.