gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

Makefile (876B)


      1 PKG := github.com/goccy/go-json
      2 
      3 BIN_DIR := $(CURDIR)/bin
      4 PKGS := $(shell go list ./... | grep -v internal/cmd|grep -v test)
      5 COVER_PKGS := $(foreach pkg,$(PKGS),$(subst $(PKG),.,$(pkg)))
      6 
      7 COMMA := ,
      8 EMPTY :=
      9 SPACE := $(EMPTY) $(EMPTY)
     10 COVERPKG_OPT := $(subst $(SPACE),$(COMMA),$(COVER_PKGS))
     11 
     12 $(BIN_DIR):
     13 	@mkdir -p $(BIN_DIR)
     14 
     15 .PHONY: cover
     16 cover:
     17 	go test -coverpkg=$(COVERPKG_OPT) -coverprofile=cover.out ./...
     18 
     19 .PHONY: cover-html
     20 cover-html: cover
     21 	go tool cover -html=cover.out
     22 
     23 .PHONY: lint
     24 lint: golangci-lint
     25 	$(BIN_DIR)/golangci-lint run
     26 
     27 golangci-lint: | $(BIN_DIR)
     28 	@{ \
     29 		set -e; \
     30 		GOLANGCI_LINT_TMP_DIR=$$(mktemp -d); \
     31 		cd $$GOLANGCI_LINT_TMP_DIR; \
     32 		go mod init tmp; \
     33 		GOBIN=$(BIN_DIR) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.48.0; \
     34 		rm -rf $$GOLANGCI_LINT_TMP_DIR; \
     35 	}
     36 
     37 .PHONY: generate
     38 generate:
     39 	go generate ./internal/...