<commit_before>GOTOOLS = \
					github.com/mitchellh/gox \
					github.com/Masterminds/glide \
					github.com/alecthomas/gometalinter

all: protoc install test

PACKAGES=$(shell go list ./... | grep -v '/vendor/')

install-protoc:
	# Download: https://github.com/google/protobuf/releases
	go get github.com/golang/protobuf/protoc-gen-go

protoc:
	@ protoc --go_out=plugins=grpc:. types/*.proto

install:
	@ go install ./cmd/...

build:
	@ go build -i ./cmd/...

dist:
	@ bash scripts/dist.sh
	@ bash scripts/publish.sh

# test.sh requires that we run the installed cmds, must not be out of date
test: install
	find . -path ./vendor -prune -o -name *.sock -exec rm {} \;
	@ go test $(PACKAGES)
	@ bash tests/test.sh

fmt:
	@ go fmt ./...

test_integrations: get_vendor_deps install test

get_deps:
	@ go get -d $(PACKAGES)

tools:
	go get -u -v $(GOTOOLS)

get_vendor_deps:
	@ go get github.com/Masterminds/glide
	@ glide install

metalinter: tools
	@gometalinter --install
	gometalinter --vendor --deadline=600s --enable-all --disable=lll ./...

metalinter_test: tools
	@gometalinter --install
	gometalinter --vendor --deadline=600s --disable-all  \
		--enable=maligned \
		--enable=deadcode \
		--enable=gas \
		--enable=goconst \
		--enable=goimports \
		--enable=gosimple \
	 	--enable=ineffassign \
		--enable=megacheck \
	 	--enable=misspell \
	   	--enable=staticcheck \
		--enable=safesql \
	   	--enable=structcheck \
	   	--enable=unconvert \
		--enable=unused \
	   	--enable=varcheck \
		--enable=vetshadow \
		./...

		#--enable=dupl \
		#--enable=errcheck \
		#--enable=gocyclo \
		#--enable=golint \ <== comments on anything exported
		#--enable=gotype \
	   	#--enable=interfacer \
	   	#--enable=unparam \
		#--enable=vet \

.PHONY: all build test fmt get_deps tools<commit_msg>install protoc<commit_after>GOTOOLS = \
					github.com/mitchellh/gox \
					github.com/Masterminds/glide \
					github.com/alecthomas/gometalinter

all: protoc install test

PACKAGES=$(shell go list ./... | grep -v '/vendor/')

install_protoc:
	# https://github.com/google/protobuf/releases
	curl -L https://github.com/google/protobuf/releases/download/v3.4.1/protobuf-cpp-3.4.1.tar.gz | tar xvz && \
		cd protobuf-cpp-3.4.1 && \
		DIST_LANG=cpp ./configure && \
		make && \
		make install && \
		cd .. && \
		rm -rf protobuf-cpp-3.4.1
	go get github.com/golang/protobuf/protoc-gen-go

protoc:
	## On "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
	##   ldconfig (may require sudo)
	## https://stackoverflow.com/a/25518702
	protoc --go_out=plugins=grpc:. types/*.proto

install:
	@ go install ./cmd/...

build:
	@ go build -i ./cmd/...

dist:
	@ bash scripts/dist.sh
	@ bash scripts/publish.sh

# test.sh requires that we run the installed cmds, must not be out of date
test: install
	find . -path ./vendor -prune -o -name *.sock -exec rm {} \;
	@ go test $(PACKAGES)
	@ bash tests/test.sh

fmt:
	@ go fmt ./...

test_integrations: get_vendor_deps install test

get_deps:
	@ go get -d $(PACKAGES)

tools:
	go get -u -v $(GOTOOLS)

get_vendor_deps:
	@ go get github.com/Masterminds/glide
	@ glide install

metalinter: tools
	@gometalinter --install
	gometalinter --vendor --deadline=600s --enable-all --disable=lll ./...

metalinter_test: tools
	@gometalinter --install
	gometalinter --vendor --deadline=600s --disable-all  \
		--enable=maligned \
		--enable=deadcode \
		--enable=gas \
		--enable=goconst \
		--enable=goimports \
		--enable=gosimple \
	 	--enable=ineffassign \
		--enable=megacheck \
	 	--enable=misspell \
	   	--enable=staticcheck \
		--enable=safesql \
	   	--enable=structcheck \
	   	--enable=unconvert \
		--enable=unused \
	   	--enable=varcheck \
		--enable=vetshadow \
		./...

		#--enable=dupl \
		#--enable=errcheck \
		#--enable=gocyclo \
		#--enable=golint \ <== comments on anything exported
		#--enable=gotype \
	   	#--enable=interfacer \
	   	#--enable=unparam \
		#--enable=vet \

.PHONY: all build test fmt get_deps tools protoc install_protoc
{'fraction_non_alphanumeric': 0.15673671199011124, 'fraction_numerical': 0.008405438813349814, 'mean_word_length': 2.6254480286738353, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '6447631', 'n_tokens_mistral': 1654, 'n_tokens_neox': 1503, 'n_words': 328}