Skip to content
Tool for generating static HTML for Go vanity import paths.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
.appveyor.yml
.gitignore
.goreleaser.yml
.travis.yml
Dockerfile.vangen
LICENSE
Makefile
README.md
cloudbuild.yaml
config.go
config_test.go
generate_index.go
generate_index_test.go
generate_package.go
generate_package_test.go
go.mod
go.sum
main.go

README.md

vangen

Linux/OSX Build Status Windows Build Status Codecov Go Report Card Go docs

Vangen is a tool for generating static HTML for Go vanity import paths.

Go vanity import paths work by serving a HTML file that tells the go get tool where to download the source from. You can still host the source code at Github, BitBucket, but the vanity URL gives you portability and other benefits.

Why

  • Maintain Go vanity import paths with a simple definition file vangen.json.
  • Host Go vanity import paths using static hosting. No need for Google AppEngine, Heroku, etc. Host the files on Github Pages, AWS S3, Google Cloud Storage, etc.

Install

Source

go get 4d63.com/vangen

Mac

curl -o /usr/local/bin/vangen https://raw.githubusercontent.com/leighmcculloch/vangen/binaries/mac/amd64/vangen && chmod +x /usr/local/bin/vangen

Linux

curl -o /usr/local/bin/vangen https://raw.githubusercontent.com/leighmcculloch/vangen/binaries/linux/amd64/vangen && chmod +x /usr/local/bin/vangen

Windows

Download the executable, and save it to your path.

Usage

  1. Create a vangen.json (see examples below)
  2. Run vangen
  3. Host the files outputted in vangen/ at your domain
  4. Try it out with go get [domain]/[package]
$ vangen -help
Vangen is a tool for generating static HTML for hosting Go repositories at a vanity import path.

Usage:

  vangen [-config=vangen.json] [-out=vangen/]

Flags:

  -config filename
        vangen json configuration filename (default "vangen.json")
  -help
        print this help list
  -out directory
        output directory that static files will be written to (default "vangen/")
  -verbose
        print verbose output when run
  -version
        print program version

Examples

Minimal

{
  "domain": "4d63.com",
  "repositories": [
    {
      "prefix": "optional",
      "subs": [
        "template"
      ],
      "url": "https://github.com/leighmcculloch/go-optional"
    }
  ]
}

All fields

{
  "domain": "4d63.com",
  "repositories": [
    {
      "prefix": "optional",
      "subs": [
        "template"
      ],
      "type": "git",
      "url": "https://github.com/leighmcculloch/go-optional",
      "source": {
        "home": "https://github.com/leighmcculloch/go-optional",
        "dir": "https://github.com/leighmcculloch/go-optional/tree/master{/dir}",
        "file": "https://github.com/leighmcculloch/go-optional/blob/master{/dir}/{file}#L{line}"
      },
      "website": {
        "url": "https://github.com/leighmcculoch/go-optional"
      }
    }
  ]
}
You can’t perform that action at this time.