-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
34 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
bin | ||
fan2go.db | ||
dist | ||
fan2go*.db | ||
fan2go*.yaml | ||
test.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
BINARY_NAME=fan2go | ||
OUTPUT_DIR=bin/ | ||
GO_FLAGS ?= | ||
NAME := fan2go | ||
OUTPUT_BIN ?= bin/${NAME} | ||
PACKAGE := github.com/markusressel/$(NAME) | ||
GIT_REV ?= $(shell git rev-parse --short HEAD) | ||
SOURCE_DATE_EPOCH ?= $(shell date +%s) | ||
DATE ?= $(shell date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ") | ||
VERSION ?= 0.6.0 | ||
|
||
build: | ||
go build -o ${OUTPUT_DIR}${BINARY_NAME} main.go | ||
test: ## Run all tests | ||
@go clean --testcache && go test -v ./... | ||
|
||
run: | ||
go build -o ${OUTPUT_DIR}${BINARY_NAME} main.go | ||
./${OUTPUT_DIR}${BINARY_NAME} | ||
build: ## Builds the CLI | ||
@go build ${GO_FLAGS} \ | ||
-ldflags "-w -s -X ${PACKAGE}/cmd.version=${VERSION} -X ${PACKAGE}/cmd.commit=${GIT_REV} -X ${PACKAGE}/cmd.date=${DATE}" \ | ||
-a -tags netgo -o ${OUTPUT_BIN} main.go | ||
|
||
test: | ||
sudo go test -v ./... | ||
run: | ||
go build -o ${OUTPUT_BIN} main.go | ||
./${OUTPUT_BIN} | ||
|
||
clean: | ||
go clean | ||
rm ${OUTPUT_DIR}${BINARY_NAME} | ||
rm ${OUTPUT_BIN} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ import ( | |
) | ||
|
||
var ( | ||
version, commit, date = "dev", "dev", "" | ||
|
||
cfgFile string | ||
noColor bool | ||
noStyle bool | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters