# Get version from flag in source code version := $(shell go run main.go -v) prep: @go fmt ./... # Formatting code @go vet ./... # Analyzing code for errors @go get ./... # Download all dependencies from go.mod @go mod tidy # Removal of unused and installing missing dependencies @go mod verify # Checking dependencies @go build -v ./... # Checking code compilation update: prep go get -u ./... install-lint: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest go install github.com/go-critic/go-critic/cmd/gocritic@latest go install github.com/securego/gosec/v2/cmd/gosec@latest lint: prep install-lint golangci-lint run ./main.go gocritic check -enableAll ./main.go gosec -severity=high ./... list: @go test -list . ./... # make test n=TestMain test: prep go test -v -cover --run $(n) ./... build: prep @echo "Build version: $(version)" CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/lazyjournal-$(VERSION)-linux-amd64 CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/lazyjournal-$(VERSION)-linux-arm64 CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o bin/lazyjournal-$(VERSION)-darwin-amd64 CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o bin/lazyjournal-$(VERSION)-darwin-arm64 CGO_ENABLED=0 GOOS=openbsd GOARCH=amd64 go build -o bin/lazyjournal-$(VERSION)-openbsd-amd64 CGO_ENABLED=0 GOOS=openbsd GOARCH=arm64 go build -o bin/lazyjournal-$(VERSION)-openbsd-arm64 CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -o bin/lazyjournal-$(VERSION)-freebsd-amd64 CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -o bin/lazyjournal-$(VERSION)-freebsd-arm64 CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o bin/lazyjournal-$(VERSION)-windows-amd64 CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -o bin/lazyjournal-$(VERSION)-windows-arm64