Update structs.go

fix: exported func NewPerson returns unexported type *store.person, which can be annoying to use
This commit is contained in:
hallizh 2020-03-20 14:47:41 +00:00 committed by GitHub
parent 3f8e58ad58
commit 6cff82dc6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,8 +12,8 @@ type person struct {
age int age int
} }
// NewPerson constructs a new person struct with the given name // newPerson constructs a new person struct with the given name
func NewPerson(name string) *person { func newPerson(name string) *person {
// You can safely return a pointer to local variable // You can safely return a pointer to local variable
// as a local variable will survive the scope of the function. // as a local variable will survive the scope of the function.
p := person{name: name} p := person{name: name}