package
2.4.16+incompatible
Repository: https://github.com/project8/hornet.git
Documentation: pkg.go.dev

# README

gogitver

A go package that inserts a git tag into your binary. Uses make to efficiently compile your go application when the git tag changes. Other source code changes will still trigger a compile. The git version/tag is created beforehand with:

git tag -a

# View the git tag: 
git describe --tags --long

# Instead of "go install" execute:
make
# Run "go install" and strip to remove debug symbols:
make strip
# Instead of "go clean" execute:
make clean

Install

gogitver must be installed as a package under your application main directory. E.g. if your application resides under ~/go/src/app, gogitver must be installed under ~/go/src/app/gogitver.

# Example
mkdir ~/go/src/app/gogitver
cd ~/go/src/app
git clone --depth 1 https://github.com/aletheia7/gogitver.git
rm -fr gogitver/.git
# Copy makefile
cp gogitver/makefile .

Create a git tag:

git tag -a 1.0.7

Run make:

make

Documentation

godoc gogitver

GNUMake

Software Version Guidelines: Semantic Versioning

Compare & parse semver version strings: godoc go-semver, code: go-semver

Example

package main
import (
	"fmt"
	// Do not use "github.com/alethiea7/gogitver"
	// It will not work
	"app/gogitver"
)

func main() {

	fmt.Println(gogitver.Git())	
	fmt.Println(gogitver.Tag())
}
Ouput
1.0.7-0-g8e9e07b
1.0.7

LGPL

# Functions

Git returns a "git describe --tags --long" Example: 1.0.2-0-g641e39f.
Tag returns a git tag Tag is the left hand side of 1.0.2-α-0-g1234567 Example: 1.0.2-α.