GOLANGCI_LINT_VERSION=v1.48.0 LINTER=./bin/golangci-lint LINTER_VERSION_FILE=./bin/.golangci-lint-version-$(GOLANGCI_LINT_VERSION) ALL_SOURCES := $(shell find * -type f -name "*.go") COVERAGE_PROFILE_RAW=./build/coverage_raw.out COVERAGE_PROFILE_RAW_HTML=./build/coverage_raw.html COVERAGE_PROFILE_FILTERED=./build/coverage.out COVERAGE_PROFILE_FILTERED_HTML=./build/coverage.html COVERAGE_ENFORCER_FLAGS=-skipcode "// COVERAGE" -packagestats -filestats -showcode TEST_BINARY=./build/go-sdk-common.test ALLOCATIONS_LOG=./build/allocations.out EASYJSON_TAG=launchdarkly_easyjson .PHONY: all build build-easyjson clean test test-easyjson test-coverage lint benchmarks benchmarks-easyjson benchmark-allocs all: build build-easyjson build: go build ./... build-easyjson: go build -tags $(EASYJSON_TAG) ./... clean: go clean test: build go test -run=not-a-real-test ./... # just ensures that the tests compile go test -v -race ./... test-easyjson: build-easyjson go test -run=not-a-real-test -tags $(EASYJSON_TAG) ./... # just ensures that the tests compile go test -v -tags $(EASYJSON_TAG) -race ./... test-coverage: $(COVERAGE_PROFILE_RAW) go run github.com/launchdarkly-labs/go-coverage-enforcer@latest $(COVERAGE_ENFORCER_FLAGS) -outprofile $(COVERAGE_PROFILE_FILTERED) $(COVERAGE_PROFILE_RAW) go tool cover -html $(COVERAGE_PROFILE_FILTERED) -o $(COVERAGE_PROFILE_FILTERED_HTML) go tool cover -html $(COVERAGE_PROFILE_RAW) -o $(COVERAGE_PROFILE_RAW_HTML) $(COVERAGE_PROFILE_RAW): $(ALL_SOURCES) @mkdir -p ./build go test -coverprofile $(COVERAGE_PROFILE_RAW) ./... >/dev/null benchmarks: build @mkdir -p ./build go test -benchmem '-run=^$$' '-bench=.*' ./... | tee build/benchmarks.out @if grep $(ALLOCATIONS_LOG) $(LINTER_VERSION_FILE): rm -f $(LINTER) curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s $(GOLANGCI_LINT_VERSION) touch $(LINTER_VERSION_FILE) lint: $(LINTER_VERSION_FILE) $(LINTER) run ./...