- VCS is Version Control System (such as
git
orhg
)- Repo root is the root path the source code repository (such as "https://github.com/kare")
- Domain is the internet address where the Go Vanity server is hosted (such as 9fans.net or kkn.fi). Domain is deduced from HTTP request or can be set as a parameter.
- Path is the path component of the Go package (such as
/cmd/tcpproxy
inkkn.fi/cmd/tcpproxy
)
- Zero dependencies.
- Redirects Go tool to VCS.
- Redirects browsers to pkg.go.dev module server by default. Module Server URL is configurable.
- Automatic configuration of cmd packages:
- All packages are redirected without sub-packages to VCS root.
- Packages whose path is prefixed with
/cmd/
redirect automatically to VCS root by stripping the/cmd
prefix from the package path. - Examples:
- Redirect request
kkn.fi/cmd/tcpproxy
togithub.com/kare/tcpproxy
- Redirect request
kkn.fi/project/sub/package
togithub.com/kare/project
- Redirect request
Vanity package supports configurable Options via the constructor. Use Option types to configure vanity handler features. Basic Options are documented below:
- Set Version Control System type.
- Configurable Version Control System HTTP URL
- Module server URL options are:
- Vanity server domain name defaults to request hostname, but it can also be configured.
- Configurable Logger which is compatible with the standard log.Logger. Default output goes to standard error.
- Configurable static content directory for images, CSS, and etc.
- Configurable IndexPageHandler. Defaults to index.html file in the static content directory root.
- Configurable robots.txt file.
go get kkn.fi/vanity
New features or bug fixes must include comprehensive unit tests.
- Search GitHub Issues for existing bugs or open a new issue to report a new bug.
- To fix an existing bug from GitHub Issues open a new GitHub Pull Request.
- Open a new GitHub Issue to discuss or propose a new feature.
- Open a new Pull Request for a new feature that has beed already discussed.
Use Makefile
to execute Go compiler, tests and tools.
Run all tests
make test
Execute short (unit) running tests
make test-unit
Execute long (integration) running tests
make test-integration
Run goimports
make goimports
Run staticcheck
make staticcheck
Run gofmt with simplify
make fmt