<commit_before># Helpful Makefile for dealing with vendoring Go adapted from from:
# http://www.compoundtheory.com/configuring-your-gopath-with-go-and-google-app-engine/
#

.PHONY: default install-tools check-update debug-env check imports fmt vet lint clean veryclean test deps serve deploy version

default: test

#Fixes a bug in OSX Make with exporting PATH environment variables
#See: http://stackoverflow.com/questions/11745634/setting-path-variable-from-inside-makefile-does-not-work-for-make-3-81
export SHELL := $(shell echo $$SHELL)

#get the path to this Makefile, its the last in this list
#MAKEFILE_LIST is the list of Makefiles that are executed.
TOP := $(dir $(lastword $(MAKEFILE_LIST)))
ROOT = $(realpath $(TOP))

GOPATH := $(ROOT)/vendor:$(ROOT)
export GOPATH

#Add our vendored GOPATH bin directory to the path as well
PATH := $(ROOT)/vendor/bin:$(PATH)
export PATH

APP_YAML = src/appengine/app.yaml

NODE_MODULES := $(ROOT)/node_modules/.bin

# Prints out all the GO environment variables. Useful to see the state
# of what is going on with the GOPATH
debug-env:
	printenv | grep 'GO'

# Only update node_modules if the package.json has changed.
node_modules: package.json
	npm install
	touch $@

install-tools: node_modules
	go get -u github.com/golang/lint/golint
	go get -u golang.org/x/tools/cmd/goimports
	go get -u github.com/mattn/goveralls

	# We don't need the source for the tools
	#rm -rf $(ROOT)/vendor/src/golang.org/lint/golint
	#rm -rf $(ROOT)/vendor/src/github.com/golang/x/tools/cmd/goimports

check-updates: install-tools
	$(NODE_MODULES)/ncu -m npm
	cd src/appengine; $(NODE_MODULES)/ncu -m bower
	# TODO Write goapp get -u script

deps: node_modules
	for pkg in github.com/miekg/dns github.com/gorilla/handlers github.com/gorilla/mux   \
		github.com/domainr/whois golang.org/x/net/context                                \
		github.com/golang/protobuf/proto google.golang.org/appengine/socket              \
		github.com/ua-parser/uap-go/uaparser github.com/kylelemons/godebug/pretty;       \
	do \
		if [ ! -d $(ROOT)/vendor/src/$$pkg ]; then \
		    echo Getting $$pkg; \
			goapp get -u $$pkg; \
		fi \
	done

check: deps fmt vet lint

fmt:
	goapp fmt appengine lib/...

vet:
	# Due to https://github.com/golang/go/issues/17571 go vet doesn't support vendored directories.
	# Disabled until that is fixed (in Go 1.9 most likely)
	# go tool vet -v src

lint:
	golint -set_exit_status src/...

test: check
	# Testing standard go
	go test lib/...

	# Testing appengine go
	goapp test lib/...
<commit_msg>Fixed some go deps for Go 1.8, and ensured bower updates its dependencies.<commit_after># Helpful Makefile for dealing with vendoring Go adapted from from:
# http://www.compoundtheory.com/configuring-your-gopath-with-go-and-google-app-engine/
#

.PHONY: default install-tools check-update debug-env check imports fmt vet lint clean veryclean test deps serve deploy version

default: test

#Fixes a bug in OSX Make with exporting PATH environment variables
#See: http://stackoverflow.com/questions/11745634/setting-path-variable-from-inside-makefile-does-not-work-for-make-3-81
export SHELL := $(shell echo $$SHELL)

#get the path to this Makefile, its the last in this list
#MAKEFILE_LIST is the list of Makefiles that are executed.
TOP := $(dir $(lastword $(MAKEFILE_LIST)))
ROOT = $(realpath $(TOP))

GOPATH := $(ROOT)/vendor:$(ROOT)
export GOPATH

#Add our vendored GOPATH bin directory to the path as well
PATH := $(ROOT)/vendor/bin:$(PATH)
export PATH

APP_YAML = src/appengine/app.yaml

NODE_MODULES := $(ROOT)/node_modules/.bin

# Prints out all the GO environment variables. Useful to see the state
# of what is going on with the GOPATH
debug-env:
	printenv | grep 'GO'

# Only update node_modules if the package.json has changed.
node_modules: package.json
	npm install
	touch $@

install-tools: node_modules
	go get -u github.com/golang/lint/golint
	go get -u golang.org/x/tools/cmd/goimports
	go get -u github.com/mattn/goveralls

	# We don't need the source for the tools
	#rm -rf $(ROOT)/vendor/src/golang.org/lint/golint
	#rm -rf $(ROOT)/vendor/src/github.com/golang/x/tools/cmd/goimports

check-updates: install-tools
	$(NODE_MODULES)/ncu -m npm
	cd src/appengine; $(NODE_MODULES)/ncu -m bower
	# TODO Write goapp get -u script

deps: node_modules
	cd src/appengine; $(NODE_MODULES)/bower install

	for pkg in github.com/miekg/dns github.com/domainr/whois                           \
	    github.com/gorilla/handlers github.com/gorilla/mux github.com/gorilla/context  \
		github.com/golang/protobuf/proto google.golang.org/appengine/socket            \
		github.com/ua-parser/uap-go/uaparser github.com/kylelemons/godebug/pretty;     \
	do \
		if [ ! -d $(ROOT)/vendor/src/$$pkg ]; then \
		    echo Getting $$pkg; \
			goapp get -u $$pkg; \
		fi \
	done

check: deps fmt vet lint

fmt:
	goapp fmt appengine lib/...

vet:
	# Due to https://github.com/golang/go/issues/17571 go vet doesn't support vendored directories.
	# Disabled until that is fixed (in Go 1.9 most likely)
	# go tool vet -v src

lint:
	golint -set_exit_status src/...

test: check
	# Testing standard go
	go test lib/...

	# Testing appengine go
	goapp test lib/...

{'fraction_non_alphanumeric': 0.11513284559106661, 'fraction_numerical': 0.007316134000770119, 'mean_word_length': 3.4439692044482464, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '1280229', 'n_tokens_mistral': 1895, 'n_tokens_neox': 1761, 'n_words': 540}