mgk.ro: mgk.ro/www/godoc Index | Files

package godoc

import "mgk.ro/www/godoc"

Package godoc serves redirects to godoc.org, including “go get” headers.

Index

Package Files

godoc.go

func Redirect Uses

func Redirect(vcs, importPath, repoPath string) http.Handler

Redirect returns an HTTP handler that redirects requests for the tree rooted at importPath to godoc.org pages for those import paths. The redirections include headers directing “go get” to satisfy the imports by checking out code from repoPath using the given version control system.

As a special case, if both importPath and repoPath end in /*, then the matching element in the importPath is substituted into the repoPath specified for “go get.”

For example, the top-level directories at rsc.io maps to individual GitHub repositories under github.com/rsc, by using:

http.Handle("/", godoc.Redirect("git", "rsc.io/*", "https://github.com/rsc/*"))

As another example, import paths starting with 9fans.net/go map to the single GitHub repository github.com/9fans/go, by using:

http.Handle("/go/", godoc.Redirect("git", "9fans.net/go", "https://github.com/9fans/go"))

Package godoc imports 5 packages (graph). Updated 2018-02-21. Refresh now. Tools for package owners.