The example variable declaration below does not inherit the fields or methods from the struct.
How can this be reformulated to access fields within the struct while retaining the append. An example is below.
Thanks in advance.
package main
import "fmt"
type employee struct {
name string
last string
}
func main() {
emp := []employee{}
emp = append(emp, employee{name: "Sam", last: "Fish"})
fmt.Printf("name is: %s\n", emp.name)
}
emp.name undefined (type []employee has no field or method name)