<commit_before>BIN=snpt
BUILD_DIR=./build
ENTRYPOINT=./cmd/snpt

.PHONY: test
test: ## Run the tests
	GO111MODULE=on go test -v ./internal/...

.PHONY: coverage
coverage: ## Generate test coverage
	GO111MODULE=on go test -race -covermode atomic -coverprofile=coverage.out ./internal/...

.PHONY: lint
lint: ## Lint the soruce files
	golangci-lint run

.PHONY: proto
proto: ## Compile protocol buffers
	protoc --go_out=. internal/snippet/snippet.proto

.PHONY: mocks
mocks: ## Generate mocks
	mockery -name=BucketKeyValueStore -recursive=true

.PHONY: build
build: ## Build the project for the current architecture
	GO111MODULE=on go build -o $(BUILD_DIR)/$(BIN) $(ENTRYPOINT)

.PHONY: build-all
build-all: ## Build the project for all supported architectures
	GO111MODULE=on gox -output "$(BUILD_DIR)/$(BIN)-$(TAG)-{{.OS}}-{{.Arch}}/$(BIN)" -os="darwin windows linux" -arch="amd64" $(ENTRYPOINT)

.PHONY: package
package: ## Package the any built binaries ready for distribution
	find $(BUILD_DIR) -mindepth 1 -maxdepth 1 -type d -execdir tar -czvf {}.tar.gz {} \;

.PHONY: clean
clean: ## Clean the workspace
	rm -rf $(BUILD_DIR)

.PHONY: install
install: install-tools ## Install project dependencies (including any required tools)
	GO111MODULE=on go mod download

.PHONY: install-tools
install-tools: ## Install tools required by the project
	GO111MODULE=off go get -u github.com/mitchellh/gox github.com/vektra/mockery/.../
	if [ -z "$(CI)" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.27.0; fi

.PHONY: fmt
fmt: ## Format the soruce files
	go fmt ./internal/... ./cmd/...<commit_msg>fix install-tools<commit_after>BIN=snpt
BUILD_DIR=./build
ENTRYPOINT=./cmd/snpt

.PHONY: test
test: ## Run the tests
	GO111MODULE=on go test -v ./internal/...

.PHONY: coverage
coverage: ## Generate test coverage
	GO111MODULE=on go test -race -covermode atomic -coverprofile=coverage.out ./internal/...

.PHONY: lint
lint: ## Lint the soruce files
	golangci-lint run

.PHONY: proto
proto: ## Compile protocol buffers
	protoc --go_out=. internal/snippet/snippet.proto

.PHONY: mocks
mocks: ## Generate mocks
	mockery -name=BucketKeyValueStore -recursive=true

.PHONY: build
build: ## Build the project for the current architecture
	GO111MODULE=on go build -o $(BUILD_DIR)/$(BIN) $(ENTRYPOINT)

.PHONY: build-all
build-all: ## Build the project for all supported architectures
	GO111MODULE=on gox -output "$(BUILD_DIR)/$(BIN)-$(TAG)-{{.OS}}-{{.Arch}}/$(BIN)" -os="darwin windows linux" -arch="amd64" $(ENTRYPOINT)

.PHONY: package
package: ## Package the any built binaries ready for distribution
	find $(BUILD_DIR) -mindepth 1 -maxdepth 1 -type d -execdir tar -czvf {}.tar.gz {} \;

.PHONY: clean
clean: ## Clean the workspace
	rm -rf $(BUILD_DIR)

.PHONY: install
install: install-tools ## Install project dependencies (including any required tools)
	GO111MODULE=on go mod download

.PHONY: install-tools
install-tools: ## Install tools required by the project
	GO111MODULE=off go get -u github.com/mitchellh/gox github.com/vektra/mockery/.../
	if [ -z "$(CI)" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.27.0; fi

.PHONY: fmt
fmt: ## Format the soruce files
	go fmt ./internal/... ./cmd/...
{'fraction_non_alphanumeric': 0.14545454545454545, 'fraction_numerical': 0.015499254843517139, 'mean_word_length': 4.046616541353384, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3411409', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1143, 'n_words': 354}