本文主要是介绍Go-godoc帮助系统,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
可以用godoc查询某个包/package/库或库函数的使用方法。通过这个命令,就可以在本地快速查找某个函数的使用方法&示例,对于效率提升还是很有帮助。示例:
D:\examples>godoc fmt Println
use 'godoc cmd/fmt' for documentation on the fmt commandfunc Println(a ...interface{}) (n int, err error)Println formats using the default formats for its operands and writes tostandard output. Spaces are always added between operands and a newlineis appended. It returns the number of bytes written and any write errorencountered.
可以尝试执行如下命令:
godoc cmd/fmt
godoc cmd/math
godoc cmd/math Sqrt
需要注意的是,godoc对于函数名称区分大小写。
这个godoc和python的pydoc命令有点类似。
这篇关于Go-godoc帮助系统的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!