Skip to content

Use a custom domain in your Go import path

License

Notifications You must be signed in to change notification settings

martyanov/govans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

govans

A simple Go server that allows you to set custom import paths for your Go packages.

Quickstart

Install:

go install github.com/martyanov/govans@latest

Configure and run the binary:

# update vans.yaml

govans

# open http://localhost:8080

Command line flags

govans -h
Usage of govans:
  -address string
        address to listen on (default "localhost:8080")
  -config string
        path to config file (default "vans.yaml")
  -tls-cert string
        path to TLS certificate file
  -tls-key string
        path to TLS key file

Configuration File

host: example.com
cache_max_age: 3600
paths:
  /foo:
    repo: https://github.com/example/foo
    display: "https://github.com/example/foo https://github.com/example/foo/tree/master{/dir} https://github.com/example/foo/blob/master{/dir}/{file}#L{line}"
    vcs: git
Key Required Description
cache_max_age optional The amount of time to cache package pages in seconds, 60 by default. Controls the max-age directive sent in the Cache-Control HTTP header.
host optional Host name to use in meta tags. You can use this option to fix the host when using this service behind a reverse proxy.
paths required Map of paths to path configurations. Each key is a path that will point to the root of a repository hosted elsewhere. The fields are documented in the Path Configuration section below.

Path Configuration

Key Required Description
display optional The last three fields of the go-source meta tag. If omitted, it is inferred from the code hosting service if possible.
repo required Root URL of the repository as it would appear in go-import meta tag.
vcs required if ambiguous If the version control system cannot be inferred, then this specifies the version control system as it would appear in go-import meta tag. This can be one of git, hg, svn, or bzr.