The reason is the *name* value is not assigned to *string* (the built-in type). It is assigned to *interace{}*. Please read the docs of fmt.Println for details.
On Friday, January 11, 2019 at 4:54:12 PM UTC-4, 伊藤和也 wrote: > > type name string > > /*func (n name) upper() string { > return strings.ToUpper(string(n)) > } > > func (n name) lower() string { > return strings.ToLower(string(n)) > }*/ > > func main() { > fmt.Println(name("john")) > } > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.