-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from opsdis/fix_config
Fix config
- Loading branch information
Showing
6 changed files
with
83 additions
and
13 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 |
---|---|---|
|
@@ -16,3 +16,4 @@ | |
build/ | ||
.vscode/ | ||
.idea/ | ||
config.yaml |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
VERSION := $(shell git describe --tags) | ||
GIT_HASH := $(shell git rev-parse --short HEAD ) | ||
|
||
GO_VERSION ?= $(shell go version) | ||
GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION)) | ||
LDFLAGS = -ldflags "-X main.Version=${VERSION} -X main.GitHash=${GIT_HASH} -X main.GoVersion=${GO_VERSION_NUMBER}" | ||
|
||
.PHONY: build | ||
build: | ||
CGO_ENABLED=0 go build ${LDFLAGS} -v -o target/aci-streamer . | ||
|
||
.PHONY: build-release | ||
build-release: build-release-amd64 build-release-arm64 | ||
|
||
.PHONY: build-release-amd64 | ||
build-release-amd64: | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o=aci-streamer.linux.amd64 . && \ | ||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o=aci-streamer.windows.amd64.exe . && \ | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o=aci-streamer.darwin.amd64 . | ||
|
||
.PHONY: build-release-arm64 | ||
build-release-arm64: | ||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build ${LDFLAGS} -o=aci-streamer.linux.arm64 . && \ | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o=aci-streamer.darwin.arm64 . | ||
|
||
.PHONY: generate-html-coverage | ||
generate-html-coverage: | ||
go tool cover -html=cover.out -o coverage.html | ||
@printf "Generated coverage html \n" | ||
|
||
.PHONY: print-coverage | ||
print-coverage: | ||
@go tool cover -func cover.out | ||
|
||
.PHONY: test-unittests | ||
test-unittests: | ||
go test -v -race -coverprofile cover.out ./... | ||
|
||
.PHONY: test | ||
test: fmt-check vet test-unittests generate-html-coverage print-coverage | ||
@printf "Successfully run tests \n" | ||
|
||
.PHONY: get-dependencies | ||
get-dependencies: | ||
go get -v -t -d ./... | ||
|
||
.PHONY: vet | ||
vet: | ||
@go vet ./... | ||
@go mod tidy | ||
|
||
test-output: | ||
$(shell echo $$GO_VERSION_NUMBER) | ||
|
||
.PHONY: fmt-fix | ||
fmt-fix: | ||
@go mod download golang.org/x/tools | ||
@go run golang.org/x/tools/cmd/goimports -w -l . | ||
|
||
.PHONY: fmt-check | ||
fmt-check: | ||
@printf "Check formatting... \n" | ||
@go mod download golang.org/x/tools | ||
@if [[ $$( go run golang.org/x/tools/cmd/goimports -l . ) ]]; then printf "Files not properly formatted. Run 'make fmt-fix' \n"; exit 1; else printf "Check formatting finished \n"; fi |
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
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