What does this code snippet do?
var i int
_ = i
I understand the use of "_" as a blank identifier, but what does the second line in the above achieve?
Here is an example from the etcd GitHub repository: etcd
What does this code snippet do?
var i int
_ = i
I understand the use of "_" as a blank identifier, but what does the second line in the above achieve?
Here is an example from the etcd GitHub repository: etcd
收起
The code is machine generated. The generator added the statements _ = i
to avoid unused variable declarations in the case where there's nothing to marshal.
The author of the code generator probably found it easier to add the blank assignment statements than to omit the variables when not needed.
报告相同问题?