[英]_ = func (assignment to function) in go
What does this code snippet do?这个代码片段有什么作用?
func funcName(para int){}
_ = funcName
first line define a function, but what does the second line?第一行定义了一个 function,但第二行是什么?
I know many situations in which underscore assign to object, what about a function?我知道很多情况下下划线分配给 object,那么 function 呢?
Here is an example from the etcd GitHub repository: link这是来自 etcd GitHub 存储库的示例: 链接
Per codes of change commit move quorum safeguard into execChangeReplicasTxn
of _ = execChangeReplicasTxn
根据更改代码提交
move quorum safeguard into execChangeReplicasTxn
_ = execChangeReplicasTxn
The removing codes of the left side are moving to function execChangeReplicasTxn
, and per the comment左侧的删除代码正在移动到 function
execChangeReplicasTxn
,并且根据评论
NB: the replication layer ensures that the below operations don't cause unavailability
It provides a code navigation link to execChangeReplicasTxn
as part of comment.它提供了一个指向
execChangeReplicasTxn
的代码导航链接作为注释的一部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.