generated from ThalesGroup/template-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (32 loc) · 1.07 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
ROOT_DIR := .
SOURCE_MAIN := cmd/server/keymanager_server.go
SOURCES := $(wildcard pkg/ciphertrustkms/*.go) $(wildcard pkg/keymanager/*.go) $(SOURCE_MAIN)
TESTS := $(shell find . -name '*_test.go')
GO_DIRS := $(shell find $(ROOT_DIR) -name '*.go' -exec dirname {} \; | sort -u)
BIN_DIR := ./bin
BIN_FILE:= $(BIN_DIR)/ciphertrust-kms-spire-plugin
BIN_HASH_FILE := $(BIN_DIR)/ciphertrust-kms-spire-plugin.sha256
build: fmt staticcheck vet goreportcard $(SOURCES)
@echo "Building..."
GOOS=linux GOARCH=amd64 go build -o $(BIN_FILE) $(SOURCE_MAIN)
@echo "Generating binary hash in $(BIN_HASH_FILE)"
sha256sum $(BIN_FILE) > $(BIN_HASH_FILE)
fmt:
@echo "Running gofmt..."
@gofmt -s -w $(SOURCES)
@gofmt -s -w $(TESTS)
staticcheck:
@echo "Running staticcheck..."
@for dir in $(GO_DIRS); do \
echo "-> $$dir..."; \
staticcheck $$dir/... || exit 1; \
done
vet:
@echo "Running go vet..."
@for dir in $(GO_DIRS); do \
echo "-> $$dir..."; \
go vet $$dir/... || exit 1; \
done
goreportcard:
@echo "Running goreportcard..."
goreportcard-cli -v