command module
v0.6.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 11 Imported by: 0



Twist generates canonical imports for your Go packages. Since it does not require a running server (ie in existing tools like uber-go/sally and rsc/go-import-redirector), Twist is particularly useful in conjunction with GitHub Pages.

A canonical import path allows you to make your package import a little fancier with a custom domain, for example:

- import ""
+ import ""


go get -u
#          [        source         ] [     canonical     ]
twist -o x

Using the example in this repo:

twist -c twist.example.yml -o x -readme

To set up your own configuration:

twist config

You'll want to commit the generated files to the GitHub Page repository of the domain you want to use for your custom import path. For example, I used Twist to set up my import paths using GitHub Pages. The repository is here, and has the following layout:
|-- CNAME (
|-- gobenchdata
|    +-- index.html (
|-- package1
|    +-- index.html (
+-- package2
     +-- index.html (

GitHub Pages serves up the contents of the repository, allowing packages to be served with my custom domain:

go get

In your Go package, you'll need to update all import paths to use the new name.

When using Go Modules, you'll also need to update the module directive in your go.mod:


go 1.12

require ( ... )


The Go Gopher

There is no documentation for this package.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL