Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Redirect

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"))

Types

This section is empty.

Source Files