//main.go
package main
import "fmt"
func main() {
p := newPerson()
fmt.Println(p.name)
}
//person.go
package main
type person struct {
name string
age int
}
func newPerson() *person{
return &person{
name: "tony",
age:30,
}
}
但运行的时候提示错误:.\main.go:5: undefined: newPerson 找不到newPerson这个函数,不知道应该怎样解决,先谢过了!