Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.1 KB

README.md

File metadata and controls

58 lines (39 loc) · 1.1 KB

gen-gitrev

Automatically generates source code to retrieve the HEAD revision of the git repository.

Download

install

$ go get github.com/fkei/gen-gitrev

Use

$ gen-gitrev -out /tmp/hoge_gen.go -pkgname main
Output generate file: /tmp/hoge_gen.go
	pacakge name: main
	revision: aa41f29462e685ebb199a205d97f938bc3789489

$ cat /tmp/hoge_gen.go
package main

func GetRevision() (string){
	return "aa41f29462e685ebb199a205d97f938bc3789489"
}

Options

$ gen-gitrev -h

Usage of gen-gitrev:
   gen-gitrev [OPTIONS] ARGS...

Options  -out="/Users/fkei/repository/github/gen-gitrev/gitrev_gen.go": output file path
  -pkgname="main": package name
  

go generate

//go:generate gen-gitrev -pkgname gen -out ./gen/gitrev_gen.go

go1.4

build

$ make # => ./gen-gitrev