https://github.com/xgfone/gover
Supply some simple public version variables.
https://github.com/xgfone/gover
go go-version version
Last synced: 7 months ago
JSON representation
Supply some simple public version variables.
- Host: GitHub
- URL: https://github.com/xgfone/gover
- Owner: xgfone
- License: apache-2.0
- Created: 2020-03-12T09:41:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-06T15:24:11.000Z (about 2 years ago)
- Last Synced: 2025-01-31T08:43:47.613Z (9 months ago)
- Topics: go, go-version, version
- Language: Go
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gover [](https://pkg.go.dev/github.com/xgfone/gover) [](https://raw.githubusercontent.com/xgfone/gover/master/LICENSE)
Provide some simple public version variables.
## Install
```
go get -u github.com/xgfone/gover
```
## Usage
```go
package main
import (
"fmt"
"github.com/xgfone/gover"
)
func main() {
fmt.Println(gover.Text())
}
```
## Build App
You need build your repo with the commands as follow
```shell
COMMIT=$(shell git rev-parse HEAD)
VERSION=$(shell git describe --tags)
BUILD_DATE=$(shell date +"%s")
go build -ldflags "-X github.com/xgfone/gover.Commit=$COMMIT -X github.com/xgfone/gover.BuildTime=$BUILD_DATE -X github.com/xgfone/gover.Version=$VERSION"
```
Or, use the shell script [`build.sh`](https://github.com/xgfone/gover/blob/master/build.sh) or the [`Makefile`](https://github.com/xgfone/gover/blob/master/Makefile).