Code :

package main

import (
  "fmt"
  "reflect"
  "time"
)

func main() {
  var now time.Time = time.Now().UTC()
  fmt.Println("now is a type of: ", reflect.TypeOf(now))
  var name string = "Carl Johannes"
  fmt.Println("name is a type of: ", reflect.TypeOf(name))
  var age int = 5
  fmt.Println("age is a type of: ", reflect.TypeOf(age))
}


Output:

$ go run type_of.go
now is:  time.Time
name is:  string
age is:  int

'Nam Site > Go' 카테고리의 다른 글

[Go] 고루틴(goroutine) 개수 설정하기  (0) 2016.09.02
[Go] File ReadLine (1)  (0) 2016.08.08

+ Recent posts