Go Data Type get type information via reflect package

Description

Go Data Type get type information via reflect package

package main/*from   w  w w. j a v  a 2 s  .c  o m*/

import (
  "fmt"
  "reflect"
  "strconv"
)

func main() {
  var b bool = true
  fmt.Println(reflect.TypeOf(b))

  var s string = strconv.FormatBool(true)
  fmt.Println(reflect.TypeOf(s))
}



PreviousNext

Related