Tool for generating static HTML for Go vanity import paths.
MIT License
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.
vangen.json
.go get 4d63.com/vangen
curl -sSL https://github.com/leighmcculloch/vangen/releases/download/v1.1.3/vangen_1.1.3_linux_amd64.tar.gz | tar xz -C /usr/local/bin vangen
curl -sSL https://github.com/leighmcculloch/vangen/releases/download/v1.1.3/vangen_1.1.3_darwin_amd64.tar.gz | tar xz -C /usr/local/bin vangen
Download the executable, and save it to your path.
vangen.json
(see examples below)vangen
vangen/
at your domaingo 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
The repository type
and source
properties will be set automatically when url
begins with https://github.com
or https://gitlab.com
. Below is a minimal config for a project hosted on GitHub.
{
"domain": "4d63.com",
"repositories": [
{
"prefix": "optional",
"subs": [
"template"
],
"url": "https://github.com/leighmcculloch/go-optional"
}
]
}
{
"domain": "4d63.com",
"docsDomain": "pkg.go.dev",
"repositories": [
{
"prefix": "optional",
"subs": [
"template"
],
"type": "git",
"hidden": false,
"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"
}
}
]
}