<commit_before># A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html

PACKAGE = $(shell go list .)
VERSION ?= $(shell git rev-parse --abbrev-ref HEAD)
COMMIT_HASH = $(shell git rev-parse --short HEAD 2>/dev/null)
BUILD_DATE = $(shell date +%FT%T%z)
LDFLAGS = -ldflags "-X ${PACKAGE}/app.Version=${VERSION} -X ${PACKAGE}/app.CommitHash=${COMMIT_HASH} -X ${PACKAGE}/app.BuildDate=${BUILD_DATE}"
BINARY_NAME = $(shell go list . | cut -d '/' -f 3)
IMAGE ?= deshboard/${BINARY_NAME}
TAG ?= ${VERSION}
GO_SOURCE_FILES = $(shell find . -type f -name "*.go" -not -name "bindata.go" -not -path "./vendor/*")
GO_PACKAGES = $(shell go list ./... | grep -v /vendor/)
GODOTENV=$(shell if which godotenv > /dev/null 2>&1; then echo "godotenv"; fi)

.PHONY: setup install proto build run watch build-docker docker clean check test watch-test fmt csfix envcheck help
.DEFAULT_GOAL := help

setup: envcheck install .env ## Setup the project for development

install: ## Install dependencies
	@glide install

.env: ## Create local env file
	cp .env.example .env

build: ## Build a binary
	go build ${LDFLAGS} -o build/${BINARY_NAME}

proto: ## Generate code from protocol buffer
	@mkdir -p model/boilerplate/
	protoc -I vendor/github.com/deshboard/boilerplate-proto/ vendor/github.com/deshboard/boilerplate-proto/boilerplate.proto  --go_out=plugins=grpc:model/boilerplate

run: build ## Build and execute a binary
ifdef GODOTENV
	${GODOTENV} build/${BINARY_NAME} ${ARGS}
else
	build/${BINARY_NAME} ${ARGS}
endif

watch: ## Watch for file changes and run the built binary
	reflex -s -t 3s -d none -r '\.go$$' -- $(MAKE) ARGS="${ARGS}" run

build-docker:
	GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o build/${BINARY_NAME}-docker

docker: build-docker ## Build a Docker image
	docker build --build-arg BINARY_NAME=${BINARY_NAME}-docker -t ${IMAGE}:${TAG} .
ifeq (${TAG}, master)
	docker tag ${IMAGE}:${TAG} ${IMAGE}:latest
endif

clean: ## Clean the working area
	rm -rf build/ vendor/ .env

check: test fmt ## Run tests and linters

test: ## Run unit tests
	@go test ${GO_PACKAGES}

watch-test: ## Watch for file changes and run tests
	reflex -t 2s -d none -r '\.go$$' -- go test ${GO_PACKAGES}<commit_msg>Add proto path to Makefile<commit_after># A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html

PACKAGE = $(shell go list .)
VERSION ?= $(shell git rev-parse --abbrev-ref HEAD)
COMMIT_HASH = $(shell git rev-parse --short HEAD 2>/dev/null)
BUILD_DATE = $(shell date +%FT%T%z)
LDFLAGS = -ldflags "-X ${PACKAGE}/app.Version=${VERSION} -X ${PACKAGE}/app.CommitHash=${COMMIT_HASH} -X ${PACKAGE}/app.BuildDate=${BUILD_DATE}"
BINARY_NAME = $(shell go list . | cut -d '/' -f 3)
IMAGE ?= deshboard/${BINARY_NAME}
TAG ?= ${VERSION}
GO_SOURCE_FILES = $(shell find . -type f -name "*.go" -not -name "bindata.go" -not -path "./vendor/*")
GO_PACKAGES = $(shell go list ./... | grep -v /vendor/)
GODOTENV=$(shell if which godotenv > /dev/null 2>&1; then echo "godotenv"; fi)
PROTO_PATH = vendor/github.com/deshboard/boilerplate-proto

.PHONY: setup install proto build run watch build-docker docker clean check test watch-test fmt csfix envcheck help
.DEFAULT_GOAL := help

setup: envcheck install .env ## Setup the project for development

install: ## Install dependencies
	@glide install

.env: ## Create local env file
	cp .env.example .env

build: ## Build a binary
	go build ${LDFLAGS} -o build/${BINARY_NAME}

proto: ## Generate code from protocol buffer
	@mkdir -p model/boilerplate/
	protoc -I ${PROTO_PATH} ${PROTO_PATH}/boilerplate.proto  --go_out=plugins=grpc:model/boilerplate

run: build ## Build and execute a binary
ifdef GODOTENV
	${GODOTENV} build/${BINARY_NAME} ${ARGS}
else
	build/${BINARY_NAME} ${ARGS}
endif

watch: ## Watch for file changes and run the built binary
	reflex -s -t 3s -d none -r '\.go$$' -- $(MAKE) ARGS="${ARGS}" run

build-docker:
	GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o build/${BINARY_NAME}-docker

docker: build-docker ## Build a Docker image
	docker build --build-arg BINARY_NAME=${BINARY_NAME}-docker -t ${IMAGE}:${TAG} .
ifeq (${TAG}, master)
	docker tag ${IMAGE}:${TAG} ${IMAGE}:latest
endif

clean: ## Clean the working area
	rm -rf build/ vendor/ .env

check: test fmt ## Run tests and linters

test: ## Run unit tests
	@go test ${GO_PACKAGES}

watch-test: ## Watch for file changes and run tests
	reflex -t 2s -d none -r '\.go$$' -- go test ${GO_PACKAGES}
{'fraction_non_alphanumeric': 0.15506824793018573, 'fraction_numerical': 0.0071604385768628325, 'mean_word_length': 4.149769585253456, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6728118', 'n_tokens_mistral': 1603, 'n_tokens_neox': 1540, 'n_words': 499}