`flag.String()`返回的是什么呢?-灵析社区

走你啊啊啊啊啊

在Go语言中有flag.String()函数,请问下: countryCodeFile = flag.String("country", "", "Path to the country code file") 1、`flag.String()`返回的是什么呢? 为何需要这样来返回? 2、countryCodeFile 不是一个字符串吗?

阅读量:10

点赞量:0

问AI
"flag#String" (https://link.segmentfault.com/?enc=n6f6iRAxnjBPFVXe9mJA6Q%3D%3D.Pmq6QMUxUW8j6EXTBzTajemD8aEEr5BCv4McnrpiueE%3D) «"String" defines a string flag with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the flag.» 返回的是一个字符串指针,里面会存储提取出的 flag 的值。