diff --git a/.github/workflows/ci-pr-checks.yaml b/.github/workflows/ci-pr-checks.yaml index e016eeee..b5bb8454 100644 --- a/.github/workflows/ci-pr-checks.yaml +++ b/.github/workflows/ci-pr-checks.yaml @@ -47,7 +47,6 @@ jobs: - name: Run lint checks uses: golangci/golangci-lint-action@v9 with: - version: 'v2.1.6' args: "--config=./.golangci.yml" env: CGO_ENABLED: ${{ env.CGO_ENABLED }} diff --git a/.golangci.yml b/.golangci.yml index bc928c25..0bbb6973 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,33 +1,70 @@ -version: "2" +# Enhanced golangci-lint configuration for llm-d-inference-scheduler +# Expanded from 22 to 30+ linters for improved code quality, security, and maintainability +# Focus on practical improvements suitable for Kubernetes controller development run: - timeout: 5m + timeout: 10m allow-parallel-runners: true -formatters: - enable: - - goimports - - gofmt - linters: enable: - - copyloopvar - - dupword - - durationcheck - - fatcontext - - ginkgolinter - - gocritic - - govet - - loggercheck - - misspell - - perfsprint - - revive - - unconvert - - makezero - - errcheck - - goconst - - ineffassign - - nakedret - - prealloc - - unparam - - unused + # === ORIGINAL LINTERS (maintained) === + - copyloopvar # Loop variable capture issues (Go 1.22+) + - dupword # Duplicate words in comments + - durationcheck # Duration multiplication issues (important for k8s timers) + - fatcontext # Nested contexts in loops + - ginkgolinter # Ginkgo test framework linting (CRITICAL - heavily used) + - gocritic # Comprehensive static code analyzer + - govet # Go's built-in static analyzer + - loggercheck # Logger usage patterns (CRITICAL for controller-runtime) + - misspell # Spelling mistakes in comments + - perfsprint # fmt.Sprintf performance issues + - revive # Go best practices and style guide + - unconvert # Unnecessary type conversions + - makezero # Slice declarations with non-zero length + - errcheck # Unchecked errors (CRITICAL for robust Go code) + - goconst # Repeated strings that should be constants + - ineffassign # Ineffectual assignments + - nakedret # Naked returns in functions longer than specified length + - prealloc # Slice pre-allocation opportunities + - unparam # Unused function parameters + - unused # Unused code (helps reduce bloat) + + # === NEW HIGH-VALUE ADDITIONS === + # Formatting and style consistency + - gofmt # Ensures code is gofmt-ed + - goimports # Import organization and unused import removal + + # Security enhancements + - gosec # Security vulnerability scanner + - bodyclose # Ensures HTTP response bodies are closed + + # Context and resource management (critical for k8s controllers) + - contextcheck # Proper context usage patterns + - noctx # HTTP requests without context + + # Character encoding safety + - asciicheck # Non-ASCII identifiers + - bidichk # Dangerous unicode character sequences + + # Enhanced error handling + - errorlint # Error wrapping scheme validation + - nilerr # Nil error handling pattern issues + + # Code quality improvements + - testpackage # Test package naming conventions + + # Import organization for large projects + - gci # Advanced import grouping + + disable: + # Linters that are too restrictive or noisy for this project type + - varnamelen # Variable name length (Go idioms favor short names) + - exhaustruct # Exhaustive struct initialization (too restrictive) + - nlreturn # Newlines before returns (too opinionated) + - wsl # Whitespace linter (too opinionated) + - lll # Line length (handled by gofmt) + - cyclop # Cyclomatic complexity (can be overly strict) + - funlen # Function length (can be overly strict) + - nestif # Nested if statements (can be overly strict) + - gocognit # Cognitive complexity (can be overly strict) diff --git a/pkg/sidecar/proxy/proxy.go b/pkg/sidecar/proxy/proxy.go index 068d7eeb..e4d22443 100644 --- a/pkg/sidecar/proxy/proxy.go +++ b/pkg/sidecar/proxy/proxy.go @@ -33,6 +33,8 @@ import ( ) const ( + requestHeaderPrefillURL = "x-prefiller-url" + requestHeaderRequestID = "x-request-id" requestHeaderRequestID = "x-request-id" requestFieldKVTransferParams = "kv_transfer_params"