当前位置:网站首页>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。
边栏推荐
- jenkins数据迁移和备份
- MySQL索引的B+树到底有多高?
- Prada, big show?In the yuan in the universe that!
- LeetCode简单题之合并相似的物品
- 11 + chrome advanced debugging skills, learn to direct efficiency increases by 666%
- ASP.NET Core依赖注入系统学习教程:ServiceDescriptor(服务注册描述类型)
- 广东10个项目入选工信部2021年物联网示范项目名单
- Loudi Sewage Treatment Plant Laboratory Construction Management
- Codeforces Round #276 (Div. 1) B. Maximum Value
- How to do foreign media publicity to grasp the key points
猜你喜欢
shell:正则表达式及三剑客grep命令
把相亲角搬到海外,不愧是咱爸妈
「网络架构」网络代理第一部分: 代理概述
一个 CRM One Order Application log 的单元测试报表
What are the five common data types of Redis?What is the corresponding data storage space?Take you to learn from scratch
Ethernet channel Ethernet channel
bgp双平面实验 路由策略控制流量
没有接班人,格力只剩“明珠精选”
LeetCode medium topic search of two-dimensional matrix
Blast!ByteDance successfully landed, only because the interview questions of LeetCode algorithm were exhausted
随机推荐
Nanodlp v2.2/v3.0 light curing circuit board, connection method of mechanical switch/photoelectric switch/proximity switch and system state level setting
实践为主,理论为辅!腾讯大佬MySQL高阶宝典震撼来袭!
C#中导入其它自定义的命名空间
Basic knowledge of switches
mSystems | 中农汪杰组揭示影响土壤“塑料际”微生物群落的机制
百度用户产品流批一体的实时数仓实践
漏洞管理计划的未来趋势
22家!北京昌平区通报存在食品安全问题餐饮服务企业
Solve the idea that unit tests cannot use Scanner
娄底植物细胞实验室建设基本组成要点
MySQL面试题——MySQL常见查询
47Haproxy Cluster
camshift achieves target tracking
22!Beijing Changping District notified catering service enterprises with food safety problems
表中存在多个索引问题? - 聚集索引,回表,覆盖索引
Ethernet channel 以太信道
Inventory of Loudi Agricultural Products Inspection Laboratory Construction Guidelines
【黑马早报】雷军称低谷期曾想转行开酒吧;拜登正式签署芯片法案;软银二季度巨亏230亿美元;北京市消协约谈每日优鲜...
I would like to ask the big guys, how to solve this error when cdc oracle initializes a 3 million table task running
九宫格抽奖动效