Categorygithub.com/pharosnet/gitcgen
modulepackage
1.2.2
Repository: https://github.com/pharosnet/gitcgen.git
Documentation: pkg.go.dev

# README

Latest Git Commit Id Generator

generate a go file contains a git commit id.

It is good to generate a go file in a go http server project, that the http server can publish a url to show it's version.

Install

Using go get

go get github.com/pharosnet/[email protected]

Using download

Usage

Commands

Nameshort NameDesc
showsshow latest git commit id
genggenerate a go file contains latest git commit id

show command args:

NameShort NameValueDesc
work_treewstringthe path of git project

gen command args:

NameShort NameValueDesc
work_treewstringthe path of git project
outputostringthe file path of generated go file, such as "./foo/bar.go"
shortsbooluse short git commit id. default is true.

Examples:

Show latest git commit id

gitcgen show -w="{TARGET_GIT_PROJECT_LOCAL_PATH}"

Generate a go file

gitcgen gen -w="{TARGET_GIT_PROJECT_LOCAL_PATH}" -o="./foo/bar.go"

Using in go generate

//go:generate gitcgen gen -w="./" -o="./versions/git_latest_commit_id.go"
func main() {
    // ...
}

Advance

Using it in CI / CD.

# Packages

No description provided by the author