천객만래 [千客萬來] (It has an interminable succession of visitors)

go lang convert struct to interface{}

p := Person{"John", 21}
var v interface{} 
v = p


go lang convert interface{} to struct

type Person struct {
	name string
    age	 uint
}

func convToStruct(v interface{}) Person {
  p := v.(Person)
  
  return p
}

 




반응형
Posted by 사용자 SB패밀리

댓글을 달아 주세요