<commit_before>.PHONY: test format vet staticcheck magneticod magneticow image image-magneticow image-magneticod

all: test magneticod magneticow

magneticod:
	go install --tags fts5 "-ldflags=-s -w -X main.compiledOn=`date -u +%Y-%m-%dT%H:%M:%SZ`" ./cmd/magneticod

magneticow:
	# TODO: minify files!
	# https://github.com/kevinburke/go-bindata
	go-bindata -o="cmd/magneticow/bindata.go" -prefix="cmd/magneticow/data/" cmd/magneticow/data/...
	go install --tags fts5 "-ldflags=-s -w -X main.compiledOn=`date -u +%Y-%m-%dT%H:%M:%SZ`" ./cmd/magneticow

image-magneticod:
	docker build -t magneticod -f Dockerfile.magneticod .

image-magneticow:
	docker build -t magneticow -f Dockerfile.magneticow .

image: image-magneticod image-magneticow

vet:
	go vet github.com/boramalper/magnetico/...

staticcheck:
	staticcheck github.com/boramalper/magnetico/...

test:
	go test github.com/boramalper/magnetico/...

format:
	gofmt -w ${GOPATH}/src/github.com/boramalper/magnetico/cmd/
	gofmt -w ${GOPATH}/src/github.com/boramalper/magnetico/pkg/

# Formatting Errors
#     Since gofmt returns zero even if there are files to be formatted, we use:
#
#       ! gofmt -d ${GOPATH}/path/ 2>&1 | read
#
#     to return 1 if there are files to be formatted, and 0 if not.
#     https://groups.google.com/forum/#!topic/Golang-Nuts/pdrN4zleUio
#
# How can I use Bash syntax in Makefile targets?
#     Because `read` is a bash command.
#     https://stackoverflow.com/a/589300/4466589
#
check-formatting: SHELL:=/bin/bash   # HERE: this is setting the shell for check-formatting only
check-formatting:
	! gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/cmd/ 2>&1 | tee /dev/fd/2 | read
	! gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/pkg/ 2>&1 | tee /dev/fd/2 | read<commit_msg>fix Makefile paths for Go Modules<commit_after>.PHONY: test format vet staticcheck magneticod magneticow image image-magneticow image-magneticod

all: test magneticod magneticow

magneticod:
	go install --tags fts5 "-ldflags=-s -w -X main.compiledOn=`date -u +%Y-%m-%dT%H:%M:%SZ`" ./cmd/magneticod

magneticow:
	# TODO: minify files!
	# https://github.com/kevinburke/go-bindata
	go-bindata -o="cmd/magneticow/bindata.go" -prefix="cmd/magneticow/data/" cmd/magneticow/data/...
	go install --tags fts5 "-ldflags=-s -w -X main.compiledOn=`date -u +%Y-%m-%dT%H:%M:%SZ`" ./cmd/magneticow

image-magneticod:
	docker build -t magneticod -f Dockerfile.magneticod .

image-magneticow:
	docker build -t magneticow -f Dockerfile.magneticow .

image: image-magneticod image-magneticow

vet:
	go vet ./...

staticcheck:
	staticcheck ./...

test:
	go test ./...

format:
	gofmt -w ./cmd/
	gofmt -w ./pkg/

# Formatting Errors
#     Since gofmt returns zero even if there are files to be formatted, we use:
#
#       ! gofmt -d ${GOPATH}/path/ 2>&1 | read
#
#     to return 1 if there are files to be formatted, and 0 if not.
#     https://groups.google.com/forum/#!topic/Golang-Nuts/pdrN4zleUio
#
# How can I use Bash syntax in Makefile targets?
#     Because `read` is a bash command.
#     https://stackoverflow.com/a/589300/4466589
#
check-formatting: SHELL:=/bin/bash   # HERE: this is setting the shell for check-formatting only
check-formatting:
	! gofmt -l ./cmd/ 2>&1 | tee /dev/fd/2 | read
	! gofmt -l ./pkg/ 2>&1 | tee /dev/fd/2 | read
{'fraction_non_alphanumeric': 0.1457073760580411, 'fraction_numerical': 0.015719467956469165, 'mean_word_length': 3.4237967914438503, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 6, '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': '5635688', 'n_tokens_mistral': 1317, 'n_tokens_neox': 1208, 'n_words': 319}