On 08.07.19 02:51, Il-seob Bae wrote:
As per the spec <https://golang.org/ref/spec#Package_initialization>,

    A reference to a method m is a method value or method expression of
    the form t.m, where the (static) type of t is not an interface type,
    and the method m is in the method set of t. It is immaterial whether
    the resulting function value t.m is invoked.


In other words, the mere presence of an interface variable guarantees /no/ dependency analysis? Here, I did a test <https://play.golang.org/p/8Fo4nUgGLBP>, but it indeed suffers the analysis. Any thoughts?


The key part is that i has dependencies and is not ready and d has no
dependencies and is ready for initialization. If you change the
initialization expression of d from a constant to a function you see
initialization in source order.

https://play.golang.org/p/0D8Lxw_KBz-

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/455d59c2-5e22-5071-717e-8b12b3c0b110%40mb0.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to