Add deadcode to Makefile

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-10-18 15:07:37 -06:00
parent f3eb70b82d
commit df92a270c7
2 changed files with 10 additions and 0 deletions

View File

@@ -73,6 +73,10 @@ etc/bash_completion.d/wwctl: wwctl
lint: $(config) lint: $(config)
$(GOLANGCI_LINT) run --build-tags "$(WW_GO_BUILD_TAGS)" --timeout=5m ./... $(GOLANGCI_LINT) run --build-tags "$(WW_GO_BUILD_TAGS)" --timeout=5m ./...
.PHONY: deadcode
deadcode: $(config)
$(GOLANG_DEADCODE) -test ./...
.PHONY: vet .PHONY: vet
vet: $(config) vet: $(config)
go vet ./... go vet ./...
@@ -221,6 +225,7 @@ wwapird: vendor
dist: vendor dist: vendor
lint: $(GOLANGCI_LINT) lint: $(GOLANGCI_LINT)
deadcode: $(GOLANG_DEADCODE)
protofiles = internal/pkg/api/routes/wwapiv1/routes.pb.go \ protofiles = internal/pkg/api/routes/wwapiv1/routes.pb.go \
internal/pkg/api/routes/wwapiv1/routes.pb.gw.go \ internal/pkg/api/routes/wwapiv1/routes.pb.gw.go \

View File

@@ -7,6 +7,8 @@ GO_TOOLS_VENDOR := $(addprefix vendor/, $(GO_TOOLS))
GOLANGCI_LINT := $(TOOLS_BIN)/golangci-lint GOLANGCI_LINT := $(TOOLS_BIN)/golangci-lint
GOLANGCI_LINT_VERSION := v1.56.2 GOLANGCI_LINT_VERSION := v1.56.2
GOLANG_DEADCODE := $(TOOLS_BIN)/deadcode
PROTOC := $(TOOLS_BIN)/protoc PROTOC := $(TOOLS_BIN)/protoc
PROTOC_GEN_GO := $(TOOLS_BIN)/protoc-gen-go PROTOC_GEN_GO := $(TOOLS_BIN)/protoc-gen-go
PROTOC_GEN_GO_GRPC := $(TOOLS_BIN)/protoc-gen-go-grpc PROTOC_GEN_GO_GRPC := $(TOOLS_BIN)/protoc-gen-go-grpc
@@ -32,6 +34,9 @@ $(GO_TOOLS_BIN):
$(GOLANGCI_LINT): $(GOLANGCI_LINT):
curl -qq -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_BIN) $(GOLANGCI_LINT_VERSION) curl -qq -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_BIN) $(GOLANGCI_LINT_VERSION)
$(GOLANG_DEADCODE):
GOBIN="$(PWD)/$(TOOLS_BIN)" go install golang.org/x/tools/cmd/deadcode@v0.24.0
$(PROTOC): $(TOOLS_DIR) $(PROTOC): $(TOOLS_DIR)
cd $(TOOLS_DIR) && curl -LO $(PROTOC_URL) && unzip -o $(notdir $(PROTOC_URL)) cd $(TOOLS_DIR) && curl -LO $(PROTOC_URL) && unzip -o $(notdir $(PROTOC_URL))
touch --no-create $(PROTOC) # by default the timestamp is preserved from the archive touch --no-create $(PROTOC) # by default the timestamp is preserved from the archive