Skip to content

check-edge-label: report missing target instead of panicking#623

Open
tamalsaha wants to merge 1 commit into
masterfrom
fix/check-edge-label-nil-target
Open

check-edge-label: report missing target instead of panicking#623
tamalsaha wants to merge 1 commit into
masterfrom
fix/check-edge-label-nil-target

Conversation

@tamalsaha
Copy link
Copy Markdown
Contributor

Summary

  • cmd/check-edge-label/main.go discarded the LoadByGVK error and then dereferenced rdTarget.Spec.Resource.Scope. The first offshoot edge pointing to an unregistered target panicked the whole check, masking any subsequent violations.
  • Now: skip the lookup when the edge has no offshoot label, report a clear "target is not registered" violation when LoadByGVK returns nil/err, and keep scanning.

Test plan

  • go run ./cmd/check-edge-label exits 0 against a clean tree (no offshoots with mismatched scope or missing targets)
  • Temporarily point an offshoot connection at a bogus GVK and verify the tool now lists it instead of panicking

🤖 Generated with Claude Code

LoadByGVK error was discarded and rdTarget then dereferenced on the
next line, so the first dangling offshoot label aborted the entire
check with a nil-pointer panic instead of listing every violation.

Treat a missing/unregistered target as the violation it is: print a
message, increment the error count, and continue scanning.

Signed-off-by: Tamal Saha <tamal@appscode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant