golang 方法参数为interface 怎么引用?

studyseo · · 3604 次点击
``` 12435 map 值 map[a:233] ```
#2
更多评论
```go package main import ( "encoding/json" "fmt" ) type s struct { } func main() { a2 := "12435" a(&a2) fmt.Println(a2) a1_str := map[string]string{ "a":"233", } a1_map := map[string]string{} a1(a1_str,&a1_map) fmt.Println("map 值",a1_map) } func a1( s map[string]string,smap interface{}) { mb, _ := json.Marshal(s) json.Unmarshal(mb,&smap) } func a(ap interface{}) { ap = 5 } ``` ```hash //运行结果 12435 map 值 map[a:233] ``` 忘解惑
#1
看了哈源码 道行太浅
#3