variables, and in another file another init() which needs these variables
to be initialized.
So, for ordering their executions, I set a global 'done' channel which the
first one sends to, and which the other receives to.
// first.go
var done chan struct{}
func init() {
// ... initialize vars ...
go func() {
for {
done <- struct{}{}
}
}()
}
// second.go
func init() {
go func() {
<-done
// ... do things with vars ...
}
}
But the sending is never done. Why? Is that because when init() finishes
its goroutines get killed? I don't see that clear from the spec.
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.