File tree Expand file tree Collapse file tree 3 files changed +13
-14
lines changed Expand file tree Collapse file tree 3 files changed +13
-14
lines changed Original file line number Diff line number Diff line change
1
+ VERSION = 0.0.1
2
+ BUILD ?=$(shell git rev-parse --short HEAD)
3
+ PKG ?=github.com/commitdev/commit0
4
+ BUILD_ARGS =-v -ldflags=all="-X ${PKG}/cmd.appVersion=${VERSION} -X ${PKG}/cmd.appBuild=${BUILD}"
5
+
1
6
check :
2
7
go test ./...
3
8
@@ -13,7 +18,7 @@ build-example-docker: clean-example
13
18
docker run -v " $( shell pwd) /example/hello-world:/project" --user $(shell id -u) :$(shell id -g) commit0:v0 generate -l go
14
19
15
20
build :
16
- go build -o commit0
21
+ go build ${BUILD_ARGS}
17
22
18
23
# Installs the CLI int your GOPATH
19
24
install-go :
Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ import (
6
6
"github.com/spf13/cobra"
7
7
)
8
8
9
+ var (
10
+ appVersion = "SNAPSHOT"
11
+ appBuild = "SNAPSHOT"
12
+ )
13
+
9
14
func init () {
10
15
rootCmd .AddCommand (versionCmd )
11
16
}
@@ -14,6 +19,7 @@ var versionCmd = &cobra.Command{
14
19
Use : "version" ,
15
20
Short : "Print the version number of commit0" ,
16
21
Run : func (cmd * cobra.Command , args []string ) {
17
- fmt .Println ("v0.0.0" ) // Updated via updateVersion.sh
22
+ fmt .Printf ("version: %v\n " , appVersion )
23
+ fmt .Printf ("build: %v\n " , appBuild )
18
24
},
19
25
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments