项目作者: nishanths

项目描述 :
Generate HTML pages with tags for custom Go import paths
高级语言: Go
项目地址: git://github.com/nishanths/metaimport.git
创建时间: 2017-11-05T20:44:44Z
项目社区:https://github.com/nishanths/metaimport

开源协议:BSD 3-Clause "New" or "Revised" License

下载


metaimport

go get github.com/nishanths/metaimport

Specify a Git repository and metaimport will generate a directory of
HTML files containing <meta name="go-import"> tags for the Go packages
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.

The program can also optionally create <meta name="go-source"> tags, as used by
godoc.org.

Example

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

will generate HTML files like:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="go-import" content="example.org/myrepo git https://github.com/user/myrepo">
  6. <meta http-equiv="refresh" content="0; url='https://godoc.org/example.org/myrepo'">
  7. </head>
  8. <body>
  9. Redirecting to <a href="https://godoc.org/example.org/myrepo">https://godoc.org/example.org/myrepo</a>
  10. </body>
  11. </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:

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

Usage

See metaimport -h.

  1. usage: metaimport [-branch branch] [-godoc] [-o dir] [-redirect] <import-prefix> <repo>
  2. metaimport generates HTML files with <meta name="go-import"> tags as expected
  3. by go get. 'repo' specifies the Git repository containing Go source code to
  4. generate meta tags for. 'import-prefix' is the import path corresponding to
  5. the repository root.
  6. Flags
  7. -branch Branch to use (default: remote's default branch).
  8. -godoc Include <meta name="go-source"> tag as expected by godoc.org (default: false).
  9. Only partial support for repositories not hosted on github.com.
  10. -o Output directory for generated HTML files (default: html).
  11. The directory is created with 0755 permissions if it doesn't exist.
  12. -redirect Redirect to godoc.org documentation when visited in a browser (default: true).
  13. Examples
  14. metaimport example.org/myrepo https://github.com/user/myrepo
  15. metaimport example.org/exproj http://code.org/r/p/exproj