Documentation
¶
Overview ¶
Package gopkg implements quick & simple go vanity package import paths.
Vanity go package import paths give a cleaner appearance to go projects by separating the source code location from the import path. It also gives flexibility to developers by allowing them to change a project's source code hosting platform without requiring the project to be renamed. Finally, it allows projects hosted on various platforms to be grouped under a common import path.
Within a Caddyfile, new go packages are added using the gopkg directive:
gopkg <path> [<vcs>] <uri>
The <path> argument corresponds to the path component of the vanity import path, e.g. for "magnax.ca/caddy/gopkg", the path would be "/caddy/gopkg". The <vcs> argument is optional, and defaults to "git". If it is specified, it is used to indicate which version control system is being used to manage the source. The <uri> argument corresponds to the URL/URL of the source code repository. Any format supported by the given VCS and the "go get" tool is can be used, as gopkg does not attempt to validate it.
Index ¶
Constants ¶
const DefaultTemplate = `` /* 142-byte string literal not displayed */
DefaultTemplate is the default HTML template used as a response.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoPackage ¶ added in v1.2.0
type GoPackage struct { // Path is the HTTP path component of the vanity import path. // // Given a vanity import path of `web.site/package/name`, the path would be `/package/name`. Path string `json:"path"` // Vcs is the version control system used by the package. // // If empty, the default is `git`. // Valid values include `git`, `hg`, `svn`, `bzr`, `cvs`. Basically, any version control system that go knows how to address. Vcs string `json:"vcs,omitempty"` // URL is the URL of the package's source. // // This is where the go tool will go to download the source code. URL string `json:"url"` // Template is the template used when returning a response (instead of redirecting). Template *template.Template }
GoPackage implements vanity go package import paths.
Vanity go package import paths give a cleaner appearance to go projects by separating the source code location from the import path. It also gives flexibility to developers by allowing them to change a project's source code hosting platform without requiring the project to be renamed. Finally, it allows projects hosted on various platforms to be grouped under a common import path.
func (GoPackage) CaddyModule ¶ added in v1.2.0
func (m GoPackage) CaddyModule() caddy.ModuleInfo