当前位置:网站首页>2022-08-09:以下go语言代码输出什么?A:否,会 panic;B:是,能正确运行;C:不清楚,看投票结果。 package main import ( “fmt“ “syn
2022-08-09:以下go语言代码输出什么?A:否,会 panic;B:是,能正确运行;C:不清楚,看投票结果。 package main import ( “fmt“ “syn
2022-08-10 12:34: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。
边栏推荐
- 神经网络学习-正则化
- Twikoo腾讯云函数部署转移到私有部署
- BEVDet4D: Exploit Temporal Cues in Multi-camera 3D Object Detection Paper Notes
- BEVDet4D: Exploit Temporal Cues in Multi-camera 3D Object Detection 论文笔记
- The basic components of Loudi plant cell laboratory construction
- LeetCode medium topic search of two-dimensional matrix
- LeetCode中等题之颠倒字符串中的单词
- 表中存在多个索引问题? - 聚集索引,回表,覆盖索引
- 【mysql索引实现原理】
- Have you guys encountered this problem?MySQL 2.2 and 2.3-SNAPSHOT are like this, it seems to be
猜你喜欢
瑞幸「翻身」?恐言之尚早
【论文+代码】PEBAL/Pixel-wise Energy-biased Abstention Learning for Anomaly Segmentation on Complex Urban Driving Scenes(复杂城市驾驶场景异常分割的像素级能量偏置弃权学习)
Jiugongge lottery animation
What are the five common data types of Redis?What is the corresponding data storage space?Take you to learn from scratch
iTextSharp操作PDF
「企业架构」应用架构概述
Merge similar items in LeetCode simple questions
燃炸!字节跳动成功上岸,只因刷爆LeetCode算法面试题
一个 CRM One Order Application log 的单元测试报表
多线程下自旋锁设计基本思想
随机推荐
How to cultivate the design thinking of ui designers?
rpn:def concat_box_prediction_layers
YTU 2295: KMP模式匹配 一(串)
协程与任务
Keithley DMM7510精准测量超低功耗设备各种运作模式功耗
【iOS】Organization of interviews
Codeforces Round #276 (Div. 1) B. Maximum Value
DNS欺骗-教程详解
C# 当前上下文中不存在InitializeComponent()
M²BEV: Multi-Camera Joint 3D Detection and Segmentation with Unified Bird’s-Eye View Representation
jenkins数据迁移和备份
在web页面播放rtsp流视频(webrtc)
娄底植物细胞实验室建设基本组成要点
BEVDet4D: Exploit Temporal Cues in Multi-camera 3D Object Detection 论文笔记
接口自动化测试基础篇
Blast!ByteDance successfully landed, only because the interview questions of LeetCode algorithm were exhausted
Twikoo腾讯云函数部署转移到私有部署
用低代码驱动IT现代化
娄底石油化工实验设计、建设规划概述
Prada, big show?In the yuan in the universe that!