Skip to content

Commit 4984043

Browse files
authored
Merge pull request #748 from devlights/add-result-in-example
2 parents 2b6b4d6 + 8805097 commit 4984043

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

examples/basic/signals/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
このディレクトリには以下のサンプルがあります。
44

5-
| file | example name | note |
6-
|------------------|-------------------------|----------------------------------------------|
7-
| notify.go | signal\_notify | signal.Notify のサンプルです |
8-
| notifycontext.go | signal\_notify\_context | Go 1.16 から追加された signal.NotifyContext のサンプルです |
9-
5+
| file | example name | note |
6+
| ---------------- | --------------------- | ---------------------------------------------------------- |
7+
| notify.go | signal_notify | signal.Notify のサンプルです |
8+
| notifycontext.go | signal_notify_context | Go 1.16 から追加された signal.NotifyContext のサンプルです |

examples/basic/signals/notify.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,20 @@ func Notify() error {
3535
}
3636

3737
return nil
38+
39+
/*
40+
$ task
41+
task: Task "build" is up to date
42+
task: [run] ./try-golang -onetime
43+
44+
ENTER EXAMPLE NAME: signal_notify
45+
46+
[Name] "signal_notify"
47+
^C[Interrupt] Ctrl-C
48+
task: Signal received: "interrupt"
49+
50+
51+
[Elapsed] 1.771348899s
52+
*/
53+
3854
}

examples/basic/signals/notifycontext.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,20 @@ func NotifyContext() error {
3636
}
3737

3838
return nil
39+
40+
/*
41+
$ task
42+
task: [build] go build .
43+
task: [run] ./try-golang -onetime
44+
45+
ENTER EXAMPLE NAME: signal_notify_context
46+
47+
[Name] "signal_notify_context"
48+
^Ctask: Signal received: "interrupt"
49+
[Interrupt] Ctrl-C
50+
51+
52+
[Elapsed] 1.113577647s
53+
*/
54+
3955
}

0 commit comments

Comments
 (0)