Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .checkmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[default]
# Checkmake configuration for dd-trace-go
# This file configures rules for Makefile linting

# Disable minphony rule - not all utility Makefiles need standard targets
[minphony]
disabled = true

# Increase max body length for complex targets like help
[maxbodylength]
maxBodyLength = 20
4 changes: 4 additions & 0 deletions .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ jobs:
- name: Copyright
run: |
go run ./scripts/check_copyright.go
- name: Run miscellaneous linters (copyright, Makefiles)
run: |
export PATH="${{ github.workspace }}/bin:${PATH}"
make lint/misc

check-modules:
runs-on: ubuntu-latest
Expand Down
31 changes: 30 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,34 @@ help: ## Show this help message
all: tools-install generate lint test ## Run complete build pipeline (tools, generate, lint, test)

.PHONY: tools-install
tools-install: ## Install development tools
tools-install: tools-install/checkmake ## Install development tools
@./scripts/install_tools.sh --tools-dir $(TOOLS) --bin-dir $(BIN)

# checkmake is installed as a pre-built binary rather than via go install
# because it requires Go 1.25+, which would force an upgrade of our _tools module.
# We keep the _tools module on Go 1.24.0 to match our main project requirements.
# For platforms without pre-built binaries, we fall back to building from source.
.PHONY: tools-install/checkmake
tools-install/checkmake: ## Install checkmake binary for Makefile linting
@mkdir -p $(BIN)
@if [ ! -f $(BIN)/checkmake ]; then \
echo "Installing checkmake..."; \
CHECKMAKE_VERSION=0.2.2; \
OS=$$(uname -s | tr '[:upper:]' '[:lower:]'); \
ARCH=$$(uname -m); \
if [ "$$ARCH" = "x86_64" ]; then ARCH="amd64"; fi; \
if [ "$$ARCH" = "aarch64" ]; then ARCH="arm64"; fi; \
BINARY="checkmake-$$CHECKMAKE_VERSION.$$OS.$$ARCH"; \
if curl -sSfL -o $(BIN)/checkmake "https://github.com/checkmake/checkmake/releases/download/$$CHECKMAKE_VERSION/$$BINARY" 2>/dev/null; then \
chmod +x $(BIN)/checkmake; \
echo "checkmake $$CHECKMAKE_VERSION installed from pre-built binary"; \
else \
echo "Pre-built binary not available for $$OS/$$ARCH, building from source..."; \
GOBIN=$(abspath $(BIN)) go install github.com/checkmake/checkmake/cmd/checkmake@latest; \
echo "checkmake installed from source"; \
fi; \
fi

.PHONY: clean
clean: ## Clean build artifacts
rm -rvf coverprofile.txt *.out *.test vendor core_coverage.txt gotestsum-*
Expand Down Expand Up @@ -44,6 +69,10 @@ lint/go/fix: tools-install ## Fix linting issues automatically
lint/shell: tools-install ## Run shell script linting checks
$(BIN_PATH) ./scripts/lint.sh --shell

.PHONY: lint/misc
lint/misc: tools-install ## Run miscellaneous linting checks (copyright, Makefiles)
$(BIN_PATH) ./scripts/lint.sh --misc

.PHONY: format
format: tools-install ## Format code
$(BIN_PATH) ./scripts/format.sh --all
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ Targets:
help Show this help message
all Run complete build pipeline (tools, generate, lint, test)
tools-install Install development tools
tools-install/checkmake Install checkmake binary for Makefile linting
clean Clean build artifacts
clean-all Clean everything including tools and temporary files
generate Run code generation
lint Run linting checks
lint/go Run Go linting checks
lint/go/fix Fix linting issues automatically
lint/shell Run shell script linting checks
lint/misc Run miscellaneous linting checks (copyright, Makefiles)
format Format code
format/shell install shfmt
test Run all tests (core, integration, contrib)
Expand Down
2 changes: 2 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ Targets:
help Show this help message
all Run complete build pipeline (tools, generate, lint, test)
tools-install Install development tools
tools-install/checkmake Install checkmake binary for Makefile linting
clean Clean build artifacts
clean-all Clean everything including tools and temporary files
generate Run code generation
lint Run linting checks
lint/go Run Go linting checks
lint/go/fix Fix linting issues automatically
lint/shell Run shell script linting checks
lint/misc Run miscellaneous linting checks (copyright, Makefiles)
format Format code
format/shell install shfmt
test Run all tests (core, integration, contrib)
Expand Down
2 changes: 1 addition & 1 deletion scripts/install_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ run "cd \"$TOOLS_DIR_ABS\" && GOWORK=$GOWORK go mod download"

# Install tools
message "Installing tools to $BIN_DIR_ABS..."
run "cd \"$TOOLS_DIR_ABS\" && GOWORK=$GOWORK GOBIN=\"$BIN_DIR_ABS\" go install \$(grep -E '^[[:space:]]*_[[:space:]]+\".*\"' tools.go | awk -F'\"' '{print \$2}')"
run "cd \"$TOOLS_DIR_ABS\" && GOWORK=$GOWORK GOBIN=\"$BIN_DIR_ABS\" go install -v \$(grep -E '^[[:space:]]*_[[:space:]]+\".*\"' tools.go | awk -F'\"' '{print \$2}')"

message "Tools installation completed successfully"
message "Installed tools are available in: $BIN_DIR"
1 change: 1 addition & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ lint_shell_files() {
lint_misc_files() {
message "Running miscellaneous linters..."
run "go run ./scripts/check_copyright.go"
run "checkmake --config=.checkmake Makefile scripts/autoreleasetagger/Makefile scripts/apiextractor/Makefile profiler/internal/fastdelta/Makefile"
}

# Parse command line arguments
Expand Down
Loading