File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ GIT_VERSION = $(shell git describe --tags --dirty)
2+ VERSION ?= $(GIT_VERSION )
3+
4+ VERSION_PACKAGE := github.com/dispatchframework/funky/pkg/version
5+
6+ GO_LDFLAGS := -X $(VERSION_PACKAGE ) .version=$(VERSION )
7+ GO_LDFLAGS += -X $(VERSION_PACKAGE ) .buildDate=$(shell date +'% Y-% m-% dT% H:% M:% SZ')
8+ GO_LDFLAGS += -X $(VERSION_PACKAGE ) .commit=$(shell git rev-parse HEAD)
9+
10+
11+ .PHONY : all
12+ all : linux
13+
14+ .PHONY : test
15+ test : # # run tests
16+ @echo running tests...
17+ $(GO ) test -v $(shell go list -v ./... | grep -v /vendor/ | grep -v integration )
18+
19+ .PHONY : linux
20+ linux :
21+ GOOS=linux go build -ldflags " $( GO_LDFLAGS) " -o funky main.go
22+
23+ .PHONY : release
24+ release : linux
25+ tar -czf funky$(VERSION ) .linux-amd64.tgz funky
Original file line number Diff line number Diff line change 1+ ///////////////////////////////////////////////////////////////////////
2+ // Copyright (c) 2018 VMware, Inc. All Rights Reserved.
3+ // SPDX-License-Identifier: Apache-2.0
4+ ///////////////////////////////////////////////////////////////////////
5+
6+ package version
7+
8+ import (
9+ "fmt"
10+ "runtime"
11+
12+ "github.com/vmware/dispatch/pkg/api/v1"
13+ )
14+
15+ // Filled by -ldflags passed to `go build`
16+ var (
17+ version string
18+ commit string
19+ buildDate string
20+ )
21+
22+ // NO TESTS
23+
24+ // Get returns information about the version/build
25+ func Get () * v1.Version {
26+ return & v1.Version {
27+ Version : version ,
28+ Commit : commit ,
29+ BuildDate : buildDate ,
30+ GoVersion : runtime .Version (),
31+ Compiler : runtime .Compiler ,
32+ Platform : fmt .Sprintf ("%s/%s" , runtime .GOOS , runtime .GOARCH ),
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments