File tree Expand file tree Collapse file tree 5 files changed +190
-0
lines changed
examples/basic/helloworld Expand file tree Collapse file tree 5 files changed +190
-0
lines changed Original file line number Diff line number Diff line change @@ -52,4 +52,28 @@ func Async() error {
5252 <- ctxs .WhenAll (procCtx , tasks ... ).Done ()
5353
5454 return nil
55+
56+ /*
57+ $ task
58+ task: [build] go build .
59+ task: [run] ./try-golang -onetime
60+
61+ ENTER EXAMPLE NAME: helloworld_async
62+
63+ [Name] "helloworld_async"
64+ [06] Hello World (01 msec delay)
65+ [10] Hello World (03 msec delay)
66+ [01] Hello World (28 msec delay)
67+ [08] Hello World (49 msec delay)
68+ [09] Hello World (64 msec delay)
69+ [07] Hello World (65 msec delay)
70+ [04] Hello World (66 msec delay)
71+ [05] Hello World (69 msec delay)
72+ [02] Hello World (75 msec delay)
73+ [03] Hello World (91 msec delay)
74+
75+
76+ [Elapsed] 91.850415ms
77+ */
78+
5579}
Original file line number Diff line number Diff line change @@ -35,4 +35,58 @@ func Async2() error {
3535 printer .run ()
3636
3737 return nil
38+
39+ /*
40+ $ task
41+ task: [build] go build .
42+ task: [run] ./try-golang -onetime
43+
44+ ENTER EXAMPLE NAME: helloworld_async2
45+
46+ [Name] "helloworld_async2"
47+ 0:world (66ms)
48+ 0:hello (189ms)
49+ 1:world (126ms)
50+ 2:world (113ms)
51+ 1:hello (143ms)
52+ 2:hello (16ms)
53+ 3:hello (7ms)
54+ 4:hello (90ms)
55+ 3:world (146ms)
56+ 5:hello (20ms)
57+ 4:world (44ms)
58+ 6:hello (54ms)
59+ 5:world (130ms)
60+ 7:hello (146ms)
61+ 6:world (108ms)
62+ 8:hello (89ms)
63+ 9:hello (152ms)
64+ 10:hello (1ms)
65+ 7:world (184ms)
66+ 11:hello (60ms)
67+ 12:hello (65ms)
68+ 8:world (178ms)
69+ 9:world (38ms)
70+ 13:hello (198ms)
71+ 14:hello (71ms)
72+ 10:world (190ms)
73+ 15:hello (134ms)
74+ 11:world (115ms)
75+ 12:world (44ms)
76+ 16:hello (120ms)
77+ 13:world (178ms)
78+ 17:hello (156ms)
79+ 18:hello (1ms)
80+ 14:world (160ms)
81+ 19:hello (117ms)
82+ 15:world (151ms)
83+ 16:world (91ms)
84+ 17:world (25ms)
85+ 18:world (131ms)
86+ 19:world (181ms)
87+
88+
89+ [Elapsed] 2.408240175s
90+ */
91+
3892}
Original file line number Diff line number Diff line change @@ -52,4 +52,58 @@ func Async3() error {
5252 }
5353
5454 return nil
55+
56+ /*
57+ $ task
58+ task: [build] go build .
59+ task: [run] ./try-golang -onetime
60+
61+ ENTER EXAMPLE NAME: helloworld_async3
62+
63+ [Name] "helloworld_async3"
64+ 0:world (88ms)
65+ 0:hello (120ms)
66+ 1:hello (68ms)
67+ 1:world (179ms)
68+ 2:world (85ms)
69+ 2:hello (195ms)
70+ 3:hello (34ms)
71+ 3:world (85ms)
72+ 4:hello (48ms)
73+ 4:world (34ms)
74+ 5:hello (68ms)
75+ 5:world (113ms)
76+ 6:hello (56ms)
77+ 7:hello (1ms)
78+ 6:world (26ms)
79+ 8:hello (195ms)
80+ 9:hello (18ms)
81+ 7:world (194ms)
82+ 8:world (69ms)
83+ 10:hello (91ms)
84+ 9:world (32ms)
85+ 10:world (6ms)
86+ 11:world (41ms)
87+ 11:hello (128ms)
88+ 12:world (79ms)
89+ 12:hello (55ms)
90+ 13:hello (36ms)
91+ 14:hello (0s)
92+ 15:hello (55ms)
93+ 13:world (161ms)
94+ 16:hello (169ms)
95+ 14:world (180ms)
96+ 15:world (101ms)
97+ 16:world (1ms)
98+ 17:hello (137ms)
99+ 17:world (16ms)
100+ 18:hello (103ms)
101+ 18:world (99ms)
102+ 19:world (17ms)
103+ 19:hello (198ms)
104+
105+
106+ [Elapsed] 1.783459428s
107+ */
108+
55109}
Original file line number Diff line number Diff line change @@ -33,6 +33,40 @@ func Mixed() error {
3333 <- ctxs .WhenAll (procCtx , syncCtx , asyncCtx ).Done ()
3434
3535 return nil
36+
37+ /*
38+ $ task
39+ task: [build] go build .
40+ task: [run] ./try-golang -onetime
41+
42+ ENTER EXAMPLE NAME: helloworld_mixed
43+
44+ [Name] "helloworld_mixed"
45+ async [02] helloworld
46+ sync [01] helloworld
47+ sync [02] helloworld
48+ sync [03] helloworld
49+ sync [04] helloworld
50+ sync [05] helloworld
51+ sync [06] helloworld
52+ async [01] helloworld
53+ sync [07] helloworld
54+ sync [08] helloworld
55+ sync [09] helloworld
56+ sync [10] helloworld
57+ async [04] helloworld
58+ async [06] helloworld
59+ async [08] helloworld
60+ async [03] helloworld
61+ async [07] helloworld
62+ async [05] helloworld
63+ async [09] helloworld
64+ async [10] helloworld
65+
66+
67+ [Elapsed] 988.12µs
68+ */
69+
3670}
3771
3872func syncOp (pCtx context.Context ) context.Context {
Original file line number Diff line number Diff line change @@ -17,4 +17,28 @@ func Sync() error {
1717 }
1818
1919 return nil
20+
21+ /*
22+ $ task
23+ task: Task "build" is up to date
24+ task: [run] ./try-golang -onetime
25+
26+ ENTER EXAMPLE NAME: helloworld_sync
27+
28+ [Name] "helloworld_sync"
29+ [01] Hello World
30+ [02] Hello World
31+ [03] Hello World
32+ [04] Hello World
33+ [05] Hello World
34+ [06] Hello World
35+ [07] Hello World
36+ [08] Hello World
37+ [09] Hello World
38+ [10] Hello World
39+
40+
41+ [Elapsed] 37.65µs
42+ */
43+
2044}
You can’t perform that action at this time.
0 commit comments