diff --git a/.github/workflows/addlicense.yml b/.github/workflows/addlicense.yml index 7cea7c576..5a9f48eec 100644 --- a/.github/workflows/addlicense.yml +++ b/.github/workflows/addlicense.yml @@ -18,4 +18,4 @@ jobs: - name: addlicense-check run: | go install github.com/google/addlicense@latest - find . -type f -name "*.go" -not -path "./distribution/*" | xargs addlicense -check + find . -type f -name "*.go" -not -path "./distribution/*" -not -path "**/generated/*" | xargs addlicense -check diff --git a/make/dashboard.mk b/make/dashboard.mk index 12ef43fb0..de984c84b 100644 --- a/make/dashboard.mk +++ b/make/dashboard.mk @@ -20,9 +20,9 @@ GOFILES ?= $(shell git ls-files '*.go') GOTEST_PACKAGES = $(shell go list ./... | grep -v -f tests/excludes.txt) UNFMT_FILES ?= $(shell gofmt -l -s $(filter-out , $(GOFILES))) -.PHONY: doc -doc: dep-install ## Generate swagger docs - swag init -g cmd/dashboard/main.go -o internal/dashboard/swagger +.PHONY: dashboard-doc +dashboard-doc: dep-install ## Generate swagger docs + swag init -g cmd/dashboard/main.go -o internal/dashboard/generated/swagger .PHONY: build-dashboard build-dashboard: ## Build oceanbase-dashboard @@ -30,7 +30,7 @@ build-dashboard: ## Build oceanbase-dashboard .PHONY: gen-bindata gen-bindata: ## Generate bindata - go-bindata -o internal/bindata/bindata.go -pkg bindata internal/assets/... + go-bindata -o internal/dashboard/generated/bindata/bindata.go -pkg bindata internal/assets/... .PHONY: clean clean: ## Clean build diff --git a/make/development.mk b/make/development.mk index 7ec1d4960..435386856 100644 --- a/make/development.mk +++ b/make/development.mk @@ -58,6 +58,15 @@ $(GOLANGCI_LINT): lint: $(GOLANGCI_LINT) ## Run linting. $(GOLANGCI_LINT) run -v --timeout=10m --max-same-issues=1000 +.PHONY: ADD_LICENSE_CHECKER +ADD_LICENSE_CHECKER ?= $(LOCALBIN)/addlicense +$(ADD_LICENSE_CHECKER): + GOBIN=$(LOCALBIN) go install github.com/google/addlicense@latest + +.PHONY: license-check +license-check: $(ADD_LICENSE_CHECKER) ## Check whether all license headers are present. + find . -type f -name "*.go" -not -path "./distribution/*" -not -path "**/generated/*" | xargs addlicense -check + .PHONY: commit-hook commit-hook: $(GOLANGCI_LINT) ## Install commit hook. touch .git/hooks/pre-commit