https://github.com/tty47/gover
GoVer
https://github.com/tty47/gover
Last synced: about 2 months ago
JSON representation
GoVer
- Host: GitHub
- URL: https://github.com/tty47/gover
- Owner: tty47
- Created: 2020-10-29T21:05:25.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-31T22:25:37.000Z (over 4 years ago)
- Last Synced: 2025-02-14T10:43:46.263Z (3 months ago)
- Language: Go
- Size: 3.55 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GoVer
Is a repository that contains differents ways to build your Go app and set the version on it.
---
## Const
Splitted in different files in which you will define the variable values.Non prod build:
[main_dev.go](https://github.com/jrmanes/gover/blob/master/const/main_dev.go)
```go
// +build !prod// Package name -> P.E
package main// const which you will set with that value -> P.E
const version = "development"
```[main_prod.go](https://github.com/jrmanes/gover/blob/master/const/main_prod.go)
```go
// +build prod// Package name -> P.E
package main// const which you will set with that value -> P.E
const version = "production"
```
---
## Vars
Build go with tags for NON pro
```go
go build
```Build go with tags for pro
```go
go build -tags prod
```
---
## Ldflags
Build go with git commit id:```go
go build -ldflags "-X main.version=$(git rev-parse HEAD)"
```
---