README

Govan

Overview

Golang package management comes built-in with standard distribution. There is no central package repository (like NPM, RubyGems) in Go. Instead code repository in itself is a package. Go uses specific meta tags or query paramters to figure out which VCS to use and where is the source code located.

All popular code hosting provides have configured the repository paths to work out of the box with Go and so packages like [github.com/ankitrgadiya/govan](http://github.com/ankitrgadiya/govan) is commonly used in projects. However the problem with such imports is that its tightly coupled with hostring provider and changing that will break all the dependencies (Not Exactly).

Go supports using custom vanity import paths which can be used to mitigate the issue. A custom domain name can be used like argc.in/govan instead of code hosting's domain which gives the developers flexibility to move around different hosting providers. This also simplifies the imports for the consumers of packages.

Non vanity import paths are considered harmful. If you are a serious project, enforce a vanity import path. #golang

— Jaana Dogan (@rakyll) August 2, 2017

Govan is a static HTML generator for vanity imports. It generates HTML files for the packages which implements the necesarry meta tags for Go distribution to process and also redirects the user (from browser) to package documentation.

Installation

Govan can be installed in the GOPATH using the following command.

go get -u argc.in/govan
  • Setup Releases with Pre-built binaries for various platforms

Usage

Govan requires initial domain setup which can be done easily using the init sub-command. This will create a configuration file govan.yaml in the current directory and create HTML for root redirect in the output directory. By default, the output directory is ./site which can be overriden by --output flag.

govan init argc.in
OR
govan init argc.in --output ./output

After the initial setup, packages can be added using add sub-command. This takes package path (without domain) and source url. This will update the configuration file and generate new HTML file for the package under output directory. For updating the source of an already existing package, same command can be re-used.

govan add govan github.com/ankitrgadiya/govan

If you need to remove an existing package, remove sub-command can be used. This just requires package name. This is an no-op command and it won't complain if there is no such package in the configuration.

govan remove govan

Finally, if you need to manually modify the configuration file for any reason or if there is a requirement to run govan in non-interactive environment then generate sub-command can be used to (re-)generate HTML files for all the packages.

govan generate

License

This project uses BSD 3-Clause License.

Expand ▾ Collapse ▴

Documentation

Overview

    Copyright © 2020 Ankit R Gadiya All rights reserved.

    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice,

    this list of conditions and the following disclaimer.
    

    2. Redistributions in binary form must reproduce the above copyright notice,

    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.
    

    3. Neither the name of the copyright holder nor the names of its contributors

    may be used to endorse or promote products derived from this software
    without specific prior written permission.
    

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    Source Files

    Directories

    Path Synopsis