当前位置:网站首页>2022-08-09:以下go语言代码输出什么?A:否,会 panic;B:是,能正确运行;C:不清楚,看投票结果。
2022-08-09:以下go语言代码输出什么?A:否,会 panic;B:是,能正确运行;C:不清楚,看投票结果。
2022-08-10 08:38:00 【福大大架构师每日一题】
2022-08-09:以下go语言代码输出什么?A:否,会 panic;B:是,能正确运行;C:不清楚,看投票结果。
package main
import (
"fmt"
"sync"
)
func main() {
wg := sync.WaitGroup{}
wg.Add(1)
go hello(wg)
wg.Wait()
}
func hello(wg sync.WaitGroup) {
fmt.Println("hello")
wg.Done()
}答案2022-08-09:
答案选A,因为 hello 的参数是 sync.WaitGroup,这会导致 main 中 wg 被复制一份,起不到该有的作用,应该改为 *sync.WaitGroup。
边栏推荐
- 1499. The maximum pile.then/deque
- Rust learning: 6.1_Slices of composite types
- 浅谈DAO+DeFi+NFT模式开发代码技术方案丨链游元宇宙NFT盲盒项目技术开发逻辑(源码程序)
- 【Unity入门计划】制作RubyAdventure03-使用碰撞体&触发器实现世界交互
- 【OAuth2】十九、OpenID Connect 动态客户端注册
- js reduce
- DAY26: GetShell project
- 阿里云数据库 RDS SQL Server 版的服务器绑定域名www.cxsdkt.cn.的呢?
- Uni applet Tencent map polygon background transparency
- nrm 使用详解
猜你喜欢
随机推荐
Guys, may I ask, the oraclecdc error report is not serialized, but I see that the source code does not inherit serialization, what is the reason?
数据库注入提权总结(一)
Spotify expresses its architectural design using the C4 model
11111
qrcode-----生成二维码
明明加了唯一索引,为什么还是产生重复数据?
解决win10win7win8系统找不到指定的模块,注册不了大漠插件的问题
短视频同城流量宣传小魔推有何优势?如何给实体商家带来销量?
iwemeta元宇宙:一个娃娃卖9999元,泡泡玛特认为一点也不贵
2022-08-01 Advanced Network Engineering (24) STP Advanced Knowledge
协同工具满足70%-90%的工作需求,成为企业香饽饽
Pieces of TensorFlow 2.9 (1)
差分、前缀和模板
Linux下载安装MySql
StringUtils的具体操作
The precise effect of network integration promotion outsourcing in the era of Internet of Things-Shenzhen Win-Win World News
【Unity入门计划】Collision2D类&Collider2D类
【微信小程序】一文读懂页面导航
Uni-app develops WeChat applet using local images as background images
1499. 满足不等式的最大值 堆/双端队列







