Update structs.go
fix: exported func NewPerson returns unexported type *store.person, which can be annoying to use
This commit is contained in:
parent
3f8e58ad58
commit
6cff82dc6c
@ -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}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user