Go源代码中如何规避循环依赖

https://go-review.googlesource.com/c/go/+/432015

https://go-review.googlesource.com/c/go/+/430895/

src/go/build/deps_test.go

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Package dag implements a language for expressing directed acyclic
graphs.

The general syntax of a rule is:

a, b < c, d;

which means c and d come after a and b in the partial order
(that is, there are edges from c and d to a and b),
but doesn't provide a relative order between a vs b or c vs d.

The rules can chain together, as in:

e < f, g < h;

which is equivalent to

e < f, g;
f, g < h;

Except for the special bottom element "NONE", each name
must appear exactly once on the right-hand side of any rule.
That rule serves as the definition of the allowed successor
for that name. The definition must appear before any uses
of the name on the left-hand side of a rule. (That is, the
rules themselves must be ordered according to the partial
order, for easier reading by people.)

Negative assertions double-check the partial order:

i !< j

means that it must NOT be the case that i < j.
Negative assertions may appear anywhere in the rules,
even before i and j have been defined.

Comments begin with #.

go test go/build

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Package dag implements a language for expressing directed acyclic
graphs.

The general syntax of a rule is:

a, b < c, d;

which means c and d come after a and b in the partial order
(that is, there are edges from c and d to a and b),
but doesn't provide a relative order between a vs b or c vs d.

The rules can chain together, as in:

e < f, g < h;

which is equivalent to

e < f, g;
f, g < h;

Except for the special bottom element "NONE", each name
must appear exactly once on the right-hand side of any rule.
That rule serves as the definition of the allowed successor
for that name. The definition must appear before any uses
of the name on the left-hand side of a rule. (That is, the
rules themselves must be ordered according to the partial
order, for easier reading by people.)

Negative assertions double-check the partial order:

i !< j

means that it must NOT be the case that i < j.
Negative assertions may appear anywhere in the rules,
even before i and j have been defined.

Comments begin with #.

文章目录