0
0

More than 3 years have passed since last update.

Golangで型情報を調べる

Posted at
golangで型情報調べる時に使う
main.go
package main

import (
    "fmt"
    "reflect"
)

func main() {

    fmt.Println(reflect.TypeOf(1))          // int
    fmt.Println(reflect.TypeOf(""))         // string
    fmt.Println(reflect.TypeOf([]string{})) // []string
    fmt.Println(reflect.TypeOf(true))       // bool
    fmt.Println(reflect.TypeOf(func() {}))  // func()

}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0