.PHONY: all dep build test lint

lint: dep ## Lint the files
	@golint -set_exit_status ./...

test: ## Run unittests
	@go test -cover -coverprofile=coverage.txt -covermode count ./...

race: dep ## Run data race detector
	@go test -race -short ./...

dep: ## Get the dependencies
	@go get -v -d ./...
	@go get -u golang.org/x/lint/golint
	@go get -u github.com/boumenot/gocover-cobertura

coverage: dep
	@go test -v -coverpkg=./... -coverprofile=cover.out ./...
	@go tool cover -func cover.out | grep total
	@go tool cover -html=cover.out -o cover.html

windows:
	$(eval export GOOS := windows)
	@go build -o builds/main ./cmd/query-service/

macos:
	$(eval export GOOS := darwin)
	@go build -o builds/main ./cmd/query-service/

linux: # Build for linux
	$(eval export GOOS := linux)
	CGO_ENABLED=0 go build -o builds/main ./cmd/query-service/

run:
	./builds/main

develop-sivan:

	$(eval export RABBIT_USER := haha-test)
	$(eval export RABBIT_PASSWORD := dikkedraak)
	$(eval export RABBIT_HOST := 192.168.178.158)
	$(eval export RABBIT_PORT := 5672)

	$(eval export LOG_MESSAGES := true)

	$(eval export REDIS_ADDRESS := localhost:6379)

	@go run cmd/query-service/main.go

	
develop:

	$(eval export RABBIT_USER := guest)
	$(eval export RABBIT_PASSWORD := guest)
	$(eval export RABBIT_HOST := localhost)
	$(eval export RABBIT_PORT := 5672)

	$(eval export LOG_MESSAGES := true)

	$(eval export REDIS_ADDRESS := localhost:6379)

	@go run cmd/query-service/main.go