Closed
Explain synthetic init wrappers in go/ssa and their impact on blank-import edge propagation#10
Conversation
Copilot
AI
changed the title
[WIP] [WIP] Address feedback on synthetic init wrappers in sideeffect imports feature
Explain synthetic init wrappers in go/ssa and their impact on blank-import edge propagation
Mar 20, 2026
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.
Addressed a question about what "synthetic init wrappers" means in the context of the sideeffect imports feature and why they matter for impact propagation.
Context
In go/ssa,
pkg.Func("init")returns a synthetic package initializer — a function generated entirely by the SSA builder withfn.Synthetic = "package initializer"and no source position (fn.Pos() == token.NoPos). It is not the user-writtenfunc init(). Instead, it orchestrates initialization by calling the real user-defined init functions (init#1,init#2, …) in order.Problem
synthesiseBlankImportEdgesbuilds edges using these synthetic init wrappers, butBuildGraphskips synthetic functions during call-graph traversal (isSynthetic()check). This breaks the propagation chain:A change to
init#1is tracked against its own key, but the call edge frominit#1into the synthetic wrapper is invisible to the graph walker — so impact never flows through blank-import edges into dependent services.Resolution
Replied to the review comment with the above explanation. The underlying propagation gap (using non-synthetic
init#Nfunctions or explicitly including synthetic init→init edges in the reverse index) remains open for follow-up.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.