关于golang的构造函数的写法来源于Rob Pike他老人家2014年寫的一篇博客:[https://commandcenter.blogspot.hk/2014/01/self-referential-functions-and-design.html],同时他也是golang语言的发明者之一。下面通过一个自己的小例子说明这种写法。同时也列出很多开源的golang项目中使用这种写法。

Example

type Person {
    name string,
    age    int64,
    country string,
    ...
}

func NewPerson(name string,age int64,country sting)*Person{
      return &Person{ name: name,
}