开发者社区> 问答> 正文

Go 语言标准库 中flag的核心代码是什么?

Go 语言标准库 中flag的核心代码是什么?

展开
收起
游客c7gnq4eofxp32 2022-05-08 22:53:26 464 0
来自:阿里技术
1 条回答
写回答
取消 提交回答
  • // demo.go var limit int flag.IntVar(&limit, "limit", 10, "the max number of results") flag.Parse() fmt.Println("the limit is", limit) // 执行结果 $ go run demo.go the limit is 10 $ go run demo.go -limit 100 the limit is 100

    2022-05-09 12:06:07
    赞同 展开评论 打赏
问答分类:
Go
问答地址:
来源圈子
更多
收录在圈子:
+ 订阅
问答排行榜
最热
最新

相关电子书

更多
Go语言路上踩过的坑 立即下载
gohbase :HBase go客户端 立即下载
Go构建日请求千亿级微服务实践 立即下载