Skip to content

Latest commit

 

History

History
69 lines (48 loc) · 1.54 KB

File metadata and controls

69 lines (48 loc) · 1.54 KB

Setup and Build

This document covers setup, build commands, and test commands for odh-cli development.

For development guidelines and coding conventions, see development.md.

Build Commands

CRITICAL: ALWAYS use make commands. NEVER invoke tools directly.

# Build the binary
make build

# Run the doctor command
make run

# Format code (NEVER use gci directly)
make fmt

# Run linter (NEVER use golangci-lint directly)
make lint

# Run linter with auto-fix (ALWAYS try this FIRST before manual fixes)
make lint/fix

# Run vulnerability scanner
make vulncheck

# Run all checks (lint + vulncheck)
make check

# Run tests
make test

# Tidy dependencies
make tidy

# Clean build artifacts
make clean

Why use make commands instead of tools directly:

  • Consistency: Ensures everyone uses the same linter configuration and settings
  • Safety: Prevents accidental changes to critical files (e.g., blank imports)
  • Correctness: Makefile handles proper tool invocation with correct flags
  • Maintainability: Tool versions and configuration centralized in one place

Prohibited commands:

  • golangci-lint run - Use make lint instead
  • gci write - Use make fmt instead
  • gofmt - Use make fmt instead
  • goimports - Use make fmt instead

Test Commands

# Run all tests with verbose output
go test -v ./...

# Run tests in a specific package
go test -v ./pkg/printer

# Run a specific test
go test -v ./pkg/printer -run TestTablePrinter

# Run tests for all packages
make test