Skip to content

Files

Latest commit

1c74697 · May 26, 2022

History

History
30 lines (19 loc) · 362 Bytes

3.1.md

File metadata and controls

30 lines (19 loc) · 362 Bytes

3.1 判断数据类型

使用反射,引入反射包

reflect.TypeOf(x)

示例:

package main

import (
    "fmt"
    "reflect"
)

func main() {
    var x string = "aaa"
    fmt.Println("type:", reflect.TypeOf(x))
}

links