Skip to content

go-project-pkg/version

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

version

Project version management pkg.

Usage

Go:

import "github.com/go-project-pkg/version"

func main() {
  fmt.Println(version.Get())
}

Shell:

VERSION_PACKAGE=github.com/go-project-pkg/version
VERSION=$(git describe --tags --always --match='v*')
GIT_COMMIT=$(git rev-parse HEAD)
GIT_TREE_STATE=dirty

if git status --porcelain 2>/dev/null;then
    GIT_TREE_STATE=clean
fi

LDFLAGS="-X $VERSION_PACKAGE.GitVersion=$VERSION
        -X $VERSION_PACKAGE.GitCommit=$GIT_COMMIT
        -X $VERSION_PACKAGE.GitTreeState=$GIT_TREE_STATE
        -X $VERSION_PACKAGE.BuildDate=$(date -u +'%Y-%m-%dT%H:%M:%SZ')"

go build -tags=jsoniter -ldflags "$LDFLAGS"
    -o _output/your-project-binaryname ./your/project/maingo/path

You can use scripts/build.sh to build the project.

About

Project version management pkg.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published