2021-11-25 17:50:18 +01:00
|
|
|
APP = cc-metric-collector
|
2022-01-19 16:41:32 +01:00
|
|
|
GOSRC_APP := metric-collector.go
|
|
|
|
GOSRC_COLLECTORS := $(wildcard collectors/*.go)
|
|
|
|
GOSRC_SINKS := $(wildcard sinks/*.go)
|
|
|
|
GOSRC_RECEIVERS := $(wildcard receivers/*.go)
|
2022-01-25 15:37:43 +01:00
|
|
|
GOSRC_INTERNAL := $(wildcard internal/*/*.go)
|
|
|
|
GOSRC := $(GOSRC_APP) $(GOSRC_COLLECTORS) $(GOSRC_SINKS) $(GOSRC_RECEIVERS) $(GOSRC_INTERNAL)
|
|
|
|
|
2021-11-25 17:50:18 +01:00
|
|
|
|
2022-01-19 16:41:32 +01:00
|
|
|
.PHONY: all
|
2021-11-25 17:50:18 +01:00
|
|
|
all: $(APP)
|
|
|
|
|
2022-01-19 16:41:32 +01:00
|
|
|
$(APP): $(GOSRC)
|
2021-11-25 17:50:18 +01:00
|
|
|
make -C collectors
|
2021-11-29 16:04:50 +01:00
|
|
|
go get
|
2022-01-19 16:41:32 +01:00
|
|
|
go build -o $(APP) $(GOSRC_APP)
|
2021-11-25 17:50:18 +01:00
|
|
|
|
2022-01-19 16:41:32 +01:00
|
|
|
.PHONY: clean
|
2021-11-29 16:04:50 +01:00
|
|
|
clean:
|
|
|
|
make -C collectors clean
|
|
|
|
rm -f $(APP)
|
|
|
|
|
2022-01-19 16:41:32 +01:00
|
|
|
.PHONY: fmt
|
2021-11-25 17:50:18 +01:00
|
|
|
fmt:
|
2022-01-19 16:41:32 +01:00
|
|
|
go fmt $(GOSRC_COLLECTORS)
|
|
|
|
go fmt $(GOSRC_SINKS)
|
|
|
|
go fmt $(GOSRC_RECEIVERS)
|
|
|
|
go fmt $(GOSRC_APP)
|
2022-01-25 15:37:43 +01:00
|
|
|
@for F in $(GOSRC_INTERNAL); do go fmt $$F; done
|
|
|
|
|
2021-11-29 16:04:50 +01:00
|
|
|
|
2022-01-20 12:09:22 +01:00
|
|
|
# Examine Go source code and reports suspicious constructs
|
|
|
|
.PHONY: vet
|
2022-01-20 12:13:50 +01:00
|
|
|
vet:
|
2022-01-20 12:09:22 +01:00
|
|
|
go vet ./...
|
|
|
|
|
|
|
|
|
|
|
|
# Run linter for the Go programming language.
|
|
|
|
# Using static analysis, it finds bugs and performance issues, offers simplifications, and enforces style rules
|
|
|
|
.PHONY: staticcheck
|
|
|
|
staticcheck:
|
|
|
|
go install honnef.co/go/tools/cmd/staticcheck@latest
|
|
|
|
$$(go env GOPATH)/bin/staticcheck ./...
|