Aha, sorry, the file order really matters here.
But for this specified case, it should not.



That's not right. I remembered in an issue thread, it is mentioned that the 
order should be

1. D is not ready (because it depends on A)
2. A is ready, so it is initialized: it gets value 3.
4. B is initialized. It gets value 2
5. C is initialized. It gets value 1
3. Now D is the earliest variable which is ready, so D is initialized. It 
gets value 1, and A is set to 1.

On Thursday, March 24, 2022 at 8:23:14 PM UTC+8 Brian Candler wrote:

> Ugh, quoting got broken there.
>
> $ go run rewritten_f1.go f2.go
> Init A
> Init B
> Init C
> 1   4   3
>
> $ go run f2.go rewritten_f1.go
> Init A
> Init B
> Init C
> 1   2   1
>
> Hopefully that will show properly.
>

-- 
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/44b3e727-53e9-4af1-8ba5-9e6d9029f771n%40googlegroups.com.

Reply via email to