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
Package initialization order is now specified more precisely. The
50
+
new algorithm is:
51
+
<ul>
52
+
<li>
53
+
Sort all packages by import path.
54
+
</li>
55
+
<li>Repeat until the list of packages is empty:
56
+
<ul>
57
+
<li>
58
+
Find the first package in the list for which all imports are
59
+
already initialized.
60
+
</li>
61
+
<li>
62
+
Initialize that package and remove it from the list.
63
+
</li>
64
+
</ul>
65
+
</li>
66
+
</ul>
67
+
This may change the behavior of some programs that rely on a
68
+
specific initialization ordering that was not expressed by explicit
69
+
imports. The behavior of such programs was not well defined by the
70
+
spec in past releases. The new rule provides an unambiguous definition.
71
+
</p>
72
+
73
+
<p><!-- https://go.dev/issue/59338 -->
74
+
TODO: <ahref="https://go.dev/issue/59338">https://go.dev/issue/59338</a>: infer type arguments from assignments of generic functions (reverse type inference)
35
75
</p>
36
76
37
77
<p><!-- https://go.dev/issue/56986 -->
@@ -745,22 +785,6 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
TODO: <ahref="https://go.dev/issue/56351">https://go.dev/issue/56351</a>: add clear(x) builtin, to clear map, zero content of slice
752
-
</p>
753
-
754
-
<p><!-- https://go.dev/issue/57411 -->
755
-
TODO: <ahref="https://go.dev/issue/57411">https://go.dev/issue/57411</a>: define initialization order more precisely
756
-
</p>
757
-
758
-
<p><!-- https://go.dev/issue/59338 -->
759
-
TODO: <ahref="https://go.dev/issue/59338">https://go.dev/issue/59338</a>: infer type arguments from assignments of generic functions (reverse type inference)
0 commit comments