BUILD_DATE = $(shell date +%F_%T_%Z_%a)
TAG=$(shell git describe --tags --abbrev=0)
GO_VERS = $(shell go version | sed -e 's/ /_/g'| cut -b 12-)
build:
	clear
	go fmt ./...
	go build  -ldflags "-w -s -X main.GoVersion=$(GO_VERS) -X main.Version=${TAG} -X main.Date=${BUILD_DATE}" -o ./bin/gostore ./cmd/gostore/main.go
	strip -s ./bin/gostore
	upx -f ./bin/gostore
dev.run:
	clear
	rm -rf ./bin_dev
	mkdir -p ./bin_dev
	cp -rf ./static ./bin_dev
	go fmt ./...
	go build -race -o ./bin_dev/gostore_dev ./cmd/gostore/main.go
	./dev.sh
mod:
	clear
	go get -u ./...
	go mod tidy -compat=1.21
	go mod vendor
	go fmt ./...
test.run:
	clear
	go fmt ./...
	go test -vet=all -race -timeout 30s -coverprofile cover.out ./...
	go tool cover -func=cover.out
lint:
	clear
	go fmt ./...
	golangci-lint run ./cmd/serv_old/...
	golangci-lint run ./cmd/client_pwa/...
	golangci-lint run ./internal/...
