修改结构体值时,重复的参数错误,s就是重复的祸根
package main
import "fmt"
type SS struct {
S string
I int
}
func (s *SS) Test(i int) {
s.I=i
}
func (s *SS) TestString(s string) {
s.S=s
}
func main() {
s:=&SS{S: "test"}
s.Test(100)
s.TestString("cheyunhua")
fmt.Println(s.S)
}
# command-line-arguments
.\test16.go:14:25: duplicate argument s
.\test16.go:15:3: s.S undefined (type string has no field or method S)

浙公网安备 33010602011771号