You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider this case:
File 1 defines M.
File 2 publicly imports file 1.
File 3 imports file 2, and references M.
Each file is in a different Go package: P1, P2, P3.
Should the generated Go code for file 3 reference P1.M, or P2.M?
The two should be equivalent, since file 2 will contain a forwarding
declaration such as "type M = P1.M".
Historically, we've gone with the latter (P2.M). This does make sense:
A generated file only imports the packages of the files that it directly
imports.
However, this does have some mildly surprising effects. If File 3
imports files 2a and 2b, each of which publicly imports file 1, we need
to arbitrarily pick one of P2a.M or P2b.M. (Admittedly an obscure case.)
Simplify the generator a little bit (and, more importantly, make it
consistent with the v2 generator) and change to referencing public
imports directly.
0 commit comments