Skip to content

Go: Improve two tests#22027

Open
owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:go/improve-tests
Open

Go: Improve two tests#22027
owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:go/improve-tests

Conversation

@owen-mc

@owen-mc owen-mc commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Two test improvements. I've pulled these two out of #21614 as they can be reviewed separately.

Copilot AI review requested due to automatic review settings June 20, 2026 21:20
@owen-mc owen-mc requested a review from a team as a code owner June 20, 2026 21:20
@owen-mc owen-mc added the no-change-note-required This PR does not need a change note label Jun 20, 2026
@github-actions github-actions Bot added the Go label Jun 20, 2026
@owen-mc owen-mc changed the title Go: Improve tests Go: Improve two tests Jun 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Go library tests by adding a dedicated CFG fixture for epilogue/defer/recover behavior and by restructuring logger-call test code so non-returning logging functions don’t accidentally make later call sites unreachable in the CFG/IR.

Changes:

  • Add a new epilogues.go fixture covering deferred calls (receiver/args evaluation timing), deferred function literals, and recover() behavior.
  • Update CFG successor expectations to include the new epilogue-related nodes/edges.
  • Refactor the LoggerCall stdlib/logrus fixtures to gate Fatal*/Panic* calls behind a selector, keeping call sites reachable for analysis.
Show a summary per file
File Description
go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/NoretFunctions.expected Regenerated expected results to account for the new CFG fixture’s impact on mayReturnNormally() results.
go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/epilogues.go New CFG test fixture exercising epilogue/defer/recover cases.
go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.expected Regenerated successor expectations to include CFG behavior for the new epilogue/recover scenarios.
go/ql/test/library-tests/semmle/go/concepts/LoggerCall/stdlib.go Refactors stdlib logger calls into selector-based branches to avoid no-return calls dominating the function.
go/ql/test/library-tests/semmle/go/concepts/LoggerCall/main.go Updates the stdlib test entrypoint to pass a selector value.
go/ql/test/library-tests/semmle/go/concepts/LoggerCall/logrus.go Refactors some logrus no-return calls behind a selector to preserve reachability.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 1

Comment on lines +115 to +118
func epiRecoverUnnamed() {
defer epiRecover()
panic("boom")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Go no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants