GO := CGO_ENABLED=0 go
IMAGE_TAG ?= latest

.PHONY: build tc-validator clean swag test

clean:
	@rm -rfv bin

build: swag tc-validator

tc-validator:
	$(GO) build -o bin/tc-validator main.go

swag: install-swag
	swag init -g handler/handler.go --parseDependency --parseInternal

test:
	go test -v -race ./...

install-swag:
ifeq (, $(shell which swag))
	@{ \
	set -e ;\
	SWAG_TMP_DIR=$$(mktemp -d) ;\
	cd $$SWAG_TMP_DIR ;\
	go get -u github.com/swaggo/swag/cmd/swag ;\
	rm -rf $$SWAG_TMP_DIR ;\
	}
endif
