go chapter 8 - 初始化对象
http://blog.haohtml.com/archives/14239
struct定义的属性如果是小写开头的,那么该属性不是public的,不能跨包调用 (implicit assignment of unexported field)
type Rect struct { x, y float64 width, height float64 } // 定义一个对象,以下四种等价。 rect1 := new(Rect) rect2 := &Rect{} rect3 := &Rect{0, 0, 100, 200} rect4 := &Rect{width:100, height:200} //=================================== package entities type Company struct { Id string Name string Phone string Address string } // 声明一个类型 r := entities.Company{Id:"001", Name:"test name", Phone:"test phone", Address:"test address"}