Canon is a tool to add canonical import paths to Go packages.
For example, given a file located at
$GOPATH/example.com/foo/foo.go with the
// Package foo docs here. package foo
Canon will update this file as:
// Package foo docs here. package foo // import "example.com/foo"
Canon will only modify a single go source file per package. If there are
multiple source files for the package, it will try to use the file that declares
the package-level documentation. If there is no package documentation, it will
then try to find a source file with the same name as the package. For example,
package main, it will try
main.go. If that still fails, it will print
an error message.
go get willnorris.com/go/tools/canon