type ByteView struct { b []byte }
ele.(ByteView)
type ByteView struct { b []byte }
ele.(ByteView)
类型断言,判断一个变量的真正类型
package main
import (
"fmt"
)
func main() {
var i interface{}
i = 1
if num , ok := i.(int);ok{
fmt.Printf("%d is int\n",num)
}
}