Skip to content

Commit 2b6b4d6

Browse files
authored
Merge pull request #747 from devlights:add-result-in-example
Add Result in examples
2 parents 89ee4b7 + e0151c4 commit 2b6b4d6

File tree

5 files changed

+68
-7
lines changed

5 files changed

+68
-7
lines changed

examples/basic/scope/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# サンプルリスト
1+
# サンプルリスト
22

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

5-
| file | example name | note |
6-
|----------------------------|-------------------------|---------------------------------|
7-
| scope\_basic.go | scope\_basic | スコープについての基本的な事項についてのサンプルです. |
8-
| scope\_common\_mistake1.go | scope\_common\_mistake1 | 変数宣言のスコープによるよくやる間違いについてのサンプルです. |
9-
| scope\_common\_mistake2.go | scope\_common\_mistake2 | CommonMistake1の間違い修正パターン (1) |
10-
| scope\_common\_mistake3.go | scope\_common\_mistake3 | CommonMistake1の間違い修正パターン (2) |
5+
| file | example name | note |
6+
| ------------------------ | --------------------- | ------------------------------------------------------------- |
7+
| scope_basic.go | scope_basic | スコープについての基本的な事項についてのサンプルです. |
8+
| scope_common_mistake1.go | scope_common_mistake1 | 変数宣言のスコープによるよくやる間違いについてのサンプルです. |
9+
| scope_common_mistake2.go | scope_common_mistake2 | CommonMistake1の間違い修正パターン (1) |
10+
| scope_common_mistake3.go | scope_common_mistake3 | CommonMistake1の間違い修正パターン (2) |
1111

examples/basic/scope/scope_basic.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ func Basic() error {
2929
ShowValues(&hasNoPublicFields)
3030

3131
return nil
32+
33+
/*
34+
$ task
35+
task: Task "build" is up to date
36+
task: [run] ./try-golang -onetime
37+
38+
ENTER EXAMPLE NAME: scope_basic
39+
40+
[Name] "scope_basic"
41+
[*mypkg.HasPublicFields] &{Val1:100 Val2:Test Value}
42+
[*mypkg.HasNoPublicFields] &{val1:0 val2:}
43+
44+
[Elapsed] 32.711µs
45+
*/
3246
}
3347

3448
// ShowValues -- サンプル関数

examples/basic/scope/scope_common_mistake1.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,19 @@ func CommonMistake1() error {
4545
// -------------------------------------------------------------------------
4646

4747
return nil
48+
49+
/*
50+
$ task
51+
task: [build] go build .
52+
task: [run] ./try-golang -onetime
53+
54+
ENTER EXAMPLE NAME: scope_common_mistake1
55+
56+
[Name] "scope_common_mistake1"
57+
[loadcwd] /workspace/try-golang
58+
[main]
59+
60+
[Elapsed] 30.79µs
61+
*/
62+
4863
}

examples/basic/scope/scope_common_mistake2.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,20 @@ func CommonMistake2() error {
3434
output.Stdoutl("[main]", _cwd2)
3535

3636
return nil
37+
38+
/*
39+
$ task
40+
task: [build] go build .
41+
task: [run] ./try-golang -onetime
42+
43+
ENTER EXAMPLE NAME: scope_common_mistake2
44+
45+
[Name] "scope_common_mistake2"
46+
[loadcwd] /workspace/try-golang
47+
[main] /workspace/try-golang
48+
49+
50+
[Elapsed] 40.04µs
51+
*/
52+
3753
}

examples/basic/scope/scope_common_mistake3.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,20 @@ func CommonMistake3() error {
3737
output.Stdoutl("[main]", pkginfo.cwd)
3838

3939
return nil
40+
41+
/*
42+
$ task
43+
task: [build] go build .
44+
task: [run] ./try-golang -onetime
45+
46+
ENTER EXAMPLE NAME: scope_common_mistake3
47+
48+
[Name] "scope_common_mistake3"
49+
[loadcwd] /workspace/try-golang
50+
[main] /workspace/try-golang
51+
52+
53+
[Elapsed] 48.82µs
54+
*/
55+
4056
}

0 commit comments

Comments
 (0)