modvanity

command module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: BSD-3-Clause Imports: 13 Imported by: 0

README

modvanity

go get github.com/axw/modvanity

Specify a Git repository and modvanity will generate a directory of HTML files containing <meta name="go-import"> tags for the Go modules in the repository, suited for your vanity URL.

These tags are used by commands such as go get to determine how to fetch source code. See go help importpath for details.

Example

$ modvanity -o html example.org/myrepo https://github.com/user/myrepo

will generate HTML files like:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="go-import" content="example.org/myrepo git https://github.com/user/myrepo">
    <meta http-equiv="refresh" content="0; url='https://godoc.org/example.org/myrepo'">
  </head>
  <body>
    Redirecting to <a href="https://pkg.golang.ir/example.org/myrepo">https://pkg.golang.ir/example.org/myrepo</a>
  </body>
</html>

Once the HTML files are generated, you can serve them at the root of your domain (example.org in this example) with something like:

$ cd html/example.org
$ file-server . # serve files in the directory over https
$ go get example.org/myrepo # should now work

Usage

See modvanity -h.

usage: modvanity [-branch branch] [-o dir] [-redirect] <import-prefix> <repo>

modvanity generates HTML files with <meta name="go-import"> tags as expected
by go get. 'repo' specifies the GitHub repository containing Go modules.
'import-prefix' is the import path corresponding to the repository root.

Flags
   -branch    Branch to use (default: remote's default branch).
   -o         Output directory for generated HTML files (default: html).
              The directory is created with 0755 permissions if it doesn't exist.
   -redirect  Redirect to pkg.go.dev documentation when visited in a browser (default: true).
   -v         Log verbosely (default: false).

Examples
   modvanity go.elastic.co/apm https://github.com/elastic/apm-agent-go

Documentation

Overview

Command modvanity generates HTML files containing <meta name="go-import"> tags for Go modules in a GitHub repository.

Jump to

Keyboard shortcuts

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