diff --git a/examples/structs/structs.go b/examples/structs/structs.go index 384b57c..268f65f 100644 --- a/examples/structs/structs.go +++ b/examples/structs/structs.go @@ -12,8 +12,8 @@ type person struct { age int } -// NewPerson constructs a new person struct with the given name -func NewPerson(name string) *person { +// `newPerson` constructs a new person struct with the given name. +func newPerson(name string) *person { // You can safely return a pointer to local variable // as a local variable will survive the scope of the function. p := person{name: name} @@ -36,7 +36,7 @@ func main() { fmt.Println(&person{name: "Ann", age: 40}) // It's idiomatic to encapsulate new struct creation in constructor functions - fmt.Println(NewPerson("Jon")) + fmt.Println(newPerson("Jon")) // Access struct fields with a dot. s := person{name: "Sean", age: 50}