gregoryv / stamp

Generates build information from standardized git repositories

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status codecov Maintainability

stamp - Parses out build information to embed into your binary

Normalize how version and build information makes it's way into your binaries. Generates code that can be used to add flags

-v    Print version and exit
-vv
      Print version with details and exit

Quick start

Install

go get github.com/gregoryv/stamp/...

Example main.go

//go:generate stamp -go build_stamp.go -clfile changelog.md
package main

import (
	"github.com/gregoryv/stamp"
	"flag"
)

func main() {
	stamp.InitFlags() // Defines -v and -vv flags
	flag.Parse()
	stamp.AsFlagged()
	//...
}

Then generate with

go generate .
go build .

Details

stamp depends on git and that you have a CHANGELOG.md. The changelog is parsed for the latest released version and assumes it follows http://keepachangelog.com/en/1.0.0/ format.

About

Generates build information from standardized git repositories

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Go 91.9%Language:Shell 8.1%