compilerenv: remove constructor panic to satisfy custom Go lint#43044
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
fix(compilerenv): avoid panic in New when getter is nil
compilerenv: remove constructor panic to satisfy custom Go lint
Jul 2, 2026
Copilot created this pull request from a session on behalf of
pelikhan
July 2, 2026 21:54
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the compilerenv package constructor to avoid panicking on nil injection (to satisfy the repo’s “no panic in library code” lint rule), and adjusts tests accordingly. It also includes a broad regeneration of workflow .lock.yml files that bumps the gh-aw-firewall image/tag from 0.27.20 to 0.27.22.
Changes:
- Replace
panicincompilerenv.New(nil)with a safe fallback toos.Getenv. - Update the unit test to assert the new
New(nil)behavior viaResolveDefaultMaxTurns. - Regenerate multiple workflow lockfiles, updating embedded firewall image/tag/version references (
0.27.20→0.27.22).
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/compilerenv/manager.go | Removes constructor panic; New(nil) now falls back to os.Getenv. |
| pkg/workflow/compilerenv/manager_test.go | Updates test coverage to validate the new nil-constructor behavior. |
| .github/workflows/test-workflow.lock.yml | Regenerated lockfile with firewall image/tag bump to 0.27.22. |
| .github/workflows/smoke-opencode.lock.yml | Regenerated lockfile with firewall image/tag bump to 0.27.22. |
| .github/workflows/smoke-crush.lock.yml | Regenerated lockfile with firewall image/tag bump to 0.27.22. |
| .github/workflows/smoke-antigravity.lock.yml | Regenerated lockfile with firewall image/tag bump to 0.27.22. |
| .github/workflows/firewall.lock.yml | Regenerated lockfile with firewall image/tag bump to 0.27.22. |
| .github/workflows/example-permissions-warning.lock.yml | Regenerated lockfile with firewall image/tag bump to 0.27.22. |
| .github/workflows/daily-max-ai-credits-test.lock.yml | Regenerated lockfile with firewall image/tag bump to 0.27.22. |
| .github/workflows/daily-malicious-code-scan.lock.yml | Regenerated lockfile with firewall image/tag bump to 0.27.22. |
| .github/workflows/codex-github-remote-mcp-test.lock.yml | Regenerated lockfile with firewall image/tag bump to 0.27.22. |
| .github/workflows/bot-detection.lock.yml | Regenerated lockfile with firewall image/tag bump to 0.27.22. |
| .github/workflows/agentic-token-optimizer.lock.yml | Regenerated lockfile with firewall image/tag bump to 0.27.22. |
| .github/workflows/ace-editor.lock.yml | Regenerated lockfile with firewall image/tag bump to 0.27.22. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 41/260 changed files
- Comments generated: 2
- Review effort level: Low
Comment on lines
26
to
30
| // New creates a Manager using the provided EnvGetter for environment lookups. | ||
| func New(getenv EnvGetter) *Manager { | ||
| if getenv == nil { | ||
| panic("compilerenv: getenv must not be nil") | ||
| getenv = os.Getenv | ||
| } |
| @@ -1,5 +1,5 @@ | |||
| # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"5814ea2bda11902a25a3e75c0189405073fc82b9712830686467627cff58c7e9","body_hash":"3a147e0e12646872769eb5643fbcb96fc4f9aab3c7b23bf999dade4ea82bd684","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.68","copilot-sdk":"1.0.5"}} | |||
| # gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GH_AW_OTEL_GRAFANA_AUTHORIZATION","GH_AW_OTEL_GRAFANA_ENDPOINT","GH_AW_OTEL_SENTRY_AUTHORIZATION","GH_AW_OTEL_SENTRY_ENDPOINT","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/cache/save","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.20"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.20"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.20"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.32","digest":"sha256:63e46b56dfd70895a701b6fc6dd0189e11e2d875f327f1781e81b31848735477","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.32@sha256:63e46b56dfd70895a701b6fc6dd0189e11e2d875f327f1781e81b31848735477"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.5.0","digest":"sha256:e25564dccc9110a70a77b9df560cbde11aa392fcb5f08b9abe5c4ebc6d146ea4","pinned_image":"ghcr.io/github/github-mcp-server:v1.5.0@sha256:e25564dccc9110a70a77b9df560cbde11aa392fcb5f08b9abe5c4ebc6d146ea4"}]} | |||
| # gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GH_AW_OTEL_GRAFANA_AUTHORIZATION","GH_AW_OTEL_GRAFANA_ENDPOINT","GH_AW_OTEL_SENTRY_AUTHORIZATION","GH_AW_OTEL_SENTRY_ENDPOINT","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/cache/save","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/checkout","sha":"9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0","version":"v7.0.0"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.22"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.22"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.22"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.32","digest":"sha256:63e46b56dfd70895a701b6fc6dd0189e11e2d875f327f1781e81b31848735477","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.32@sha256:63e46b56dfd70895a701b6fc6dd0189e11e2d875f327f1781e81b31848735477"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b","pinned_image":"ghcr.io/github/gh-aw-node@sha256:529d02eb970b1161aa25c593a9c3df57fdfad5a8add328cb3b6eccef66f3183b"},{"image":"ghcr.io/github/github-mcp-server:v1.5.0","digest":"sha256:e25564dccc9110a70a77b9df560cbde11aa392fcb5f08b9abe5c4ebc6d146ea4","pinned_image":"ghcr.io/github/github-mcp-server:v1.5.0@sha256:e25564dccc9110a70a77b9df560cbde11aa392fcb5f08b9abe5c4ebc6d146ea4"}]} | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CGO workflow failed in
golint-custombecausepkg/workflow/compilerenv/manager.goused a panic in library code (New(nil)). This change removes that failure mode and keeps constructor behavior safe under nil injection.Problem surfaced by CI
New(getenv EnvGetter)panicked onnil, violating the repository lint rule: “avoid panic in library code; return an error instead”.Behavior change
New(nil)now falls back toos.Getenvinstead of panicking.Managerinstance even when caller injection is omitted.Test updates
New(nil)reads process env values viaResolveDefaultMaxTurns.