Skip to content

Commit 1542466

Browse files
committed
Update reflection/typeof.go
1 parent a04be95 commit 1542466

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

internal/examples/advanced/reflection/examples.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ func NewRegister() mappings.Register {
1616

1717
// Regist -- 登録します.
1818
func (r *register) Regist(m mappings.ExampleMapping) {
19-
m["reflection01"] = TypeOf
19+
m["reflect_typeof"] = TypeOf
2020
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
package reflection
22

33
import (
4-
"fmt"
54
"reflect"
5+
6+
"github.com/devlights/gomy/output"
67
)
78

89
// TypeOf -- reflect.TypeOf() のサンプル
9-
//noinspection GoNameStartsWithPackageName
1010
func TypeOf() error {
1111
// 特定の値の型を調べる場合には、reflect.TypeOf() を利用する
1212
// C# でいう、 "hello world".GetType() と同じような感じ
1313
// Name メソッドで名前を取得できる
1414
i := 0
1515
t1 := reflect.TypeOf(i)
16-
fmt.Printf("%s\n", t1.Name())
16+
output.Stdoutf("[int]", "%v\t%s\n", i, t1.Name())
1717

1818
s := "hello world"
1919
t2 := reflect.TypeOf(s)
20-
fmt.Printf("%s\n", t2.Name())
20+
output.Stdoutf("[string]", "%v\t%s\n", s, t2.Name())
2121

2222
return nil
2323
}

0 commit comments

Comments
 (0)