Skip to content

[Code Quality] Extract proxyEnvVars() static map to package-level var in compiler_difc_proxy.go #46759

Description

@github-actions

Description

compiler_difc_proxy.go contains a proxyEnvVars() function that returns a 34-entry static map. Since the map never changes at runtime, it should be promoted to a package-level var (or const-like var). This removes the overhead of re-allocating the map on every call and improves readability by making the static nature explicit.

This was flagged in the Daily Compiler Code Quality report. The file otherwise scores 85/100 (Good) with excellent tests.

Suggested Changes

  1. Move the proxyEnvVars() return value to a package-level var proxyEnvVarsMap = map[string]string{ ... } (or similar)
  2. Update all callers of proxyEnvVars() to reference the package-level var directly, or keep the function as a thin accessor over the var
  3. Remove the function if no callers need encapsulation
  4. Run make test to confirm no regressions

Files Affected

  • pkg/compiler/compiler_difc_proxy.go (630 lines)

Success Criteria

  • proxyEnvVars is a package-level var (allocated once at program start)
  • All existing tests pass
  • go vet reports no issues
  • No performance regression

Source

Extracted from [daily-compiler-quality] Daily Compiler Code Quality Report - 2026-07-20

Priority

Low — minor performance and readability improvement; low risk

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 44.8 AIC · ⌖ 7.87 AIC · ⊞ 7K ·

  • expires on Jul 20, 2026, 11:51 PM UTC-08:00

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions