<commit_before>APP = lekcije
VENDOR_DIR = vendor
PROTO_GEN_DIR = proto-gen
GRPC_GATEWAY_REPO = github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis
GO_GET ?= go get
GO_TEST ?= go test -v -race -p=1 # To avoid database operations conflict
GO_TEST_PACKAGES = $(shell go list ./... | grep -v vendor | grep -v e2e)
DB_HOST = 192.168.99.100
LINT_PACKAGES = $(shell go list ./...)
VERSION_HASH_VALUE = $(shell git rev-parse HEAD | cut -c-7)
PID = $(APP).pid

all: install

.PHONY: setup
setup: install-dep install-commands

.PHONY: install-dep
install-dep:
	dep ensure -v

.PHONY: install-commands
install-commands:
	$(GO_GET) bitbucket.org/liamstask/goose/cmd/goose
	$(GO_GET) github.com/golang/protobuf/protoc-gen-go
	$(GO_GET) github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
	$(GO_GET) honnef.co/go/tools/cmd/staticcheck
	$(GO_GET) honnef.co/go/tools/cmd/gosimple
	$(GO_GET) honnef.co/go/tools/cmd/unused

.PHONY: install
install:
	go install github.com/oinume/lekcije/server/cmd/lekcije

build:
	go build -o bin/$(APP) github.com/oinume/lekcije/server/cmd/lekcije

clean:
	${RM} bin/$(APP)

.PHONY: proto/go
proto/go:
	rm -rf $(PROTO_GEN_DIR)/go && mkdir -p $(PROTO_GEN_DIR)/go
	protoc -I/usr/local/include -I. \
  		-I$(GOPATH)/src \
  		-I$(VENDOR_DIR)/$(GRPC_GATEWAY_REPO) \
  		--go_out=plugins=grpc:$(PROTO_GEN_DIR)/go \
  		proto/api/v1/*.proto
	protoc -I/usr/local/include -I. -I$(GOPATH)/src -I$(VENDOR_DIR)/$(GRPC_GATEWAY_REPO) \
		--grpc-gateway_out=logtostderr=true:$(PROTO_GEN_DIR)/go \
		proto/api/v1/*.proto

.PHONY: ngrok
ngrok:
	ngrok http -subdomain=lekcije -host-header=localhost 4000

.PHONY: test
test: go-test e2e-test

.PHONY: e2e-test
e2e-test: minify-static-development
	$(GO_TEST) github.com/oinume/lekcije/e2e

.PHONY: go-test
go-test:
	$(GO_TEST) $(GO_TEST_PACKAGES)

.PHONY: goimports
goimports:
	goimports -w ./server ./e2e

.PHONY: go-lint
go-lint: go-staticcheck go-simple

.PHONY: go-vet
go-vet:
	go vet -v $(LINT_PACKAGES)

.PHONY: go-staticcheck
go-staticcheck:
	staticcheck $(LINT_PACKAGES)

.PHONY: go-simple
go-simple:
	gosimple $(LINT_PACKAGES)
<commit_msg>Avoid data race<commit_after>APP = lekcije
VENDOR_DIR = vendor
PROTO_GEN_DIR = proto-gen
GRPC_GATEWAY_REPO = github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis
GO_GET ?= go get
GO_TEST ?= go test -v -race -p=1 # To avoid database operations conflict
GO_TEST_E2E ?= go test -v -p=1
GO_TEST_PACKAGES = $(shell go list ./... | grep -v vendor | grep -v e2e)
DB_HOST = 192.168.99.100
LINT_PACKAGES = $(shell go list ./...)
VERSION_HASH_VALUE = $(shell git rev-parse HEAD | cut -c-7)
PID = $(APP).pid

all: install

.PHONY: setup
setup: install-dep install-commands

.PHONY: install-dep
install-dep:
	dep ensure -v

.PHONY: install-commands
install-commands:
	$(GO_GET) bitbucket.org/liamstask/goose/cmd/goose
	$(GO_GET) github.com/golang/protobuf/protoc-gen-go
	$(GO_GET) github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
	$(GO_GET) honnef.co/go/tools/cmd/staticcheck
	$(GO_GET) honnef.co/go/tools/cmd/gosimple
	$(GO_GET) honnef.co/go/tools/cmd/unused

.PHONY: install
install:
	go install github.com/oinume/lekcije/server/cmd/lekcije

build:
	go build -o bin/$(APP) github.com/oinume/lekcije/server/cmd/lekcije

clean:
	${RM} bin/$(APP)

.PHONY: proto/go
proto/go:
	rm -rf $(PROTO_GEN_DIR)/go && mkdir -p $(PROTO_GEN_DIR)/go
	protoc -I/usr/local/include -I. \
  		-I$(GOPATH)/src \
  		-I$(VENDOR_DIR)/$(GRPC_GATEWAY_REPO) \
  		--go_out=plugins=grpc:$(PROTO_GEN_DIR)/go \
  		proto/api/v1/*.proto
	protoc -I/usr/local/include -I. -I$(GOPATH)/src -I$(VENDOR_DIR)/$(GRPC_GATEWAY_REPO) \
		--grpc-gateway_out=logtostderr=true:$(PROTO_GEN_DIR)/go \
		proto/api/v1/*.proto

.PHONY: ngrok
ngrok:
	ngrok http -subdomain=lekcije -host-header=localhost 4000

.PHONY: test
test: go-test e2e-test

.PHONY: e2e-test
e2e-test: minify-static-development
	$(GO_TEST_E2E) github.com/oinume/lekcije/e2e

.PHONY: go-test
go-test:
	$(GO_TEST) $(GO_TEST_PACKAGES)

.PHONY: goimports
goimports:
	goimports -w ./server ./e2e

.PHONY: go-lint
go-lint: go-staticcheck go-simple

.PHONY: go-vet
go-vet:
	go vet -v $(LINT_PACKAGES)

.PHONY: go-staticcheck
go-staticcheck:
	staticcheck $(LINT_PACKAGES)

.PHONY: go-simple
go-simple:
	gosimple $(LINT_PACKAGES)

{'fraction_non_alphanumeric': 0.15570124092718332, 'fraction_numerical': 0.01240927183329431, 'mean_word_length': 3.950173812282735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1098150', 'n_tokens_mistral': 1944, 'n_tokens_neox': 1893, 'n_words': 339}