modulepackage
0.0.0-20220303065510-90f89e66f73e
Repository: https://github.com/go-project-pkg/version.git
Documentation: pkg.go.dev
# README
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.
# Packages
No description provided by the author
# Functions
Get returns the overall codebase version.
# Variables
BuildDate in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ').
GitCommit sha1 from git, output of $(git rev-parse HEAD).
GitTreeState state of git tree, either "clean" or "dirty".
GitVersion is semantic version.