Skip to content

kare/vanity

Repository files navigation

kkn.fi/vanity

CI Go Reference GoReportCard

Concepts

  • VCS is Version Control System (such as git or hg)
  • 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 in kkn.fi/cmd/tcpproxy)

Specification

Features

  • 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 to github.com/kare/tcpproxy
      • Redirect request kkn.fi/project/sub/package to github.com/kare/project

Vanity configurable options

Vanity package supports configurable Options via the constructor. Use Option types to configure vanity handler features. Basic Options are documented below:

Installation

go get kkn.fi/vanity

Development

New features or bug fixes must include comprehensive unit tests.

Bugs

Building new features

  1. Open a new GitHub Issue to discuss or propose a new feature.
  2. Open a new Pull Request for a new feature that has beed already discussed.

Execute compiler, tests and tools

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