标签:指针

Golang 方法中指针传值的陷阱

gopher Golang 52 次浏览 ,
package main import "fmt" type Person struct { Name string } func (p Person) test1() { p.Name = "www.gopher.cc" fmt.Println(p.Name) } func (p *Person) test2() { p.Name = "www.gopher.cc" ...
Go