Skip to content

Commit

Permalink
Makefile: build all necessary deps before the static check (#7759)
Browse files Browse the repository at this point in the history
ref #7758

Build all necessary deps before the static check to make it not rely on the build command.

Signed-off-by: JmPotato <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
JmPotato and ti-chi-bot[bot] authored Jan 26, 2024
1 parent 0d10882 commit 0d5c442
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ ifneq ($(DASHBOARD_DISTRIBUTION_DIR),)
endif
PD_SERVER_DEP += dashboard-ui

pd-server: ${PD_SERVER_DEP}
pre-build: ${PD_SERVER_DEP}

pd-server: pre-build
GOEXPERIMENT=$(BUILD_GOEXPERIMENT) CGO_ENABLED=$(BUILD_CGO_ENABLED) go build $(BUILD_FLAGS) -gcflags '$(GCFLAGS)' -ldflags '$(LDFLAGS)' -tags "$(BUILD_TAGS)" -o $(BUILD_BIN_PATH)/pd-server cmd/pd-server/main.go

pd-server-failpoint:
Expand All @@ -103,7 +105,7 @@ pd-server-failpoint:
pd-server-basic:
SWAGGER=0 DASHBOARD=0 $(MAKE) pd-server

.PHONY: build tools pd-server pd-server-basic
.PHONY: pre-build build tools pd-server pd-server-basic

# Tools

Expand Down Expand Up @@ -172,9 +174,9 @@ install-tools:

#### Static checks ####

check: install-tools tidy static generate-errdoc
check: tidy static generate-errdoc

static: install-tools
static: install-tools pre-build
@ echo "gofmt ..."
@ gofmt -s -l -d $(PACKAGE_DIRECTORIES) 2>&1 | awk '{ print } END { if (NR > 0) { exit 1 } }'
@ echo "golangci-lint ..."
Expand Down

0 comments on commit 0d5c442

Please sign in to comment.