golang/%E6%A0%B8%E5%BF%83%E7%9F%A5%E8%AF%86%E7%82%B9/%E8%AF%AD%E6%B3%95%E6%89%BE%E9%94%99%E9%A2%98 #35
Replies: 1 comment
-
|
kv["menglu"].Age = 22,这个报错是因为value是值类型,这样修改的话相当于拷贝了一份student副本修改,实际是不会影响到map里面的值的,所以编译会提示错误的。改为 kv := map[string]*Stu{"menglu": {Age: 21}}就不会报错了。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
golang/%E6%A0%B8%E5%BF%83%E7%9F%A5%E8%AF%86%E7%82%B9/%E8%AF%AD%E6%B3%95%E6%89%BE%E9%94%99%E9%A2%98
语法找错题 写出以下代码出现的问题 golang 中字符串是不能赋值 nil 的,也不能跟 nil 比较。 写出以下打印内容 找出下面代码的问题 上面的代码有严重的内存泄漏问题,出错的位置是 go fn(i),实际上代码执行后会启动 4 个协程,但是因为 ch 是非缓冲的,只可能有一个协程写入成功。而其他三个协程会一直在后台等待写入。 写出以下打印结果...
https://golangguide.top/golang/%E6%A0%B8%E5%BF%83%E7%9F%A5%E8%AF%86%E7%82%B9/%E8%AF%AD%E6%B3%95%E6%89%BE%E9%94%99%E9%A2%98.html
Beta Was this translation helpful? Give feedback.
All reactions