Code Monkey home page Code Monkey logo

metaimport's Introduction

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

$ metaimport -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://godoc.org/example.org/myrepo">https://godoc.org/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 metaimport -h.

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

metaimport generates HTML files with <meta name="go-import"> tags as expected
by go get. 'repo' specifies the Git repository containing Go source code to
generate meta tags for. 'import-prefix' is the import path corresponding to
the repository root.

Flags
   -branch    Branch to use (default: remote's default branch).
   -godoc     Include <meta name="go-source"> tag as expected by godoc.org (default: false).
              Only partial support for repositories not hosted on github.com.
   -o         Output directory for generated HTML files (default: html).
              The directory is created with 0755 permissions if it doesn't exist.
   -redirect  Redirect to godoc.org documentation when visited in a browser (default: true).

Examples
   metaimport example.org/myrepo https://github.com/user/myrepo
   metaimport example.org/exproj http://code.org/r/p/exproj

metaimport's People

Contributors

conky5 avatar nishanths avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

axw

metaimport's Issues

'go get <subpackage>' fetches parent

For example,

go get go.avalanche.space/lyft/auth

fetches github.com/nishanths/lyft when it should only be fetching github.com/nishanth/lyft/auth.

The directory in the $GOPATH that the downloaded contents are put in, however, is $GOPATH/go.avalanche.space/lyft/auth.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.