Skip to content
Generates build information from standardized git repositories
Go Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/stamp
vendor
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
changelog.go
changelog_test.go
flags.go
flags_test.go
go.mod
go.sum
onchange.sh
qa_test.go
stamp.go
stamp_test.go

README.md

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 init() {
	// Add -v and -vv flags
	stamp.InitFlags()
}

func main() {
	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.

You can’t perform that action at this time.