探索GO包

huangapple go评论77阅读模式
英文:

Exploring GO packages

问题

有没有一种方法可以探索GO语言的包?

在Java中,我可以使用"javap java.lang.String"命令查看类中的方法。GO语言中是否有类似的命令?

我在谷歌上搜索了一下,但没有得到预期的结果。

英文:

Is any way to explore the GO packages?

In java, I have using "javap java.lang.String" command for viewing the method inside of the class. Something like this, Is any command is their in GO language ?

I have search the same in google. I didn't get expected result.

答案1

得分: 1

Go代码是通过源代码和文档工具进行分发的,所以你只需要在$GOROOT/src目录中搜索源代码,或者使用godoc工具,或者直接访问http://golang.org/pkg/获取标准库的文档,或者访问https://godoc.org/获取其他许多库的文档。

在命令行中运行godoc <pkg name>,例如godoc encoding/json

顺便说一下,你也可以获取Java库的源代码,所以使用javap肯定不是最短的路径。Java文档也可以在线获取,网址是https://docs.oracle.com/javase/8/docs/api/。

英文:

Go code is distributed with source and documentation tooling so you just need to search for sources in $GOROOT/src directory or use godoc tool or simply go to http://golang.org/pkg/ for standard library or https://godoc.org/ for many other libraries.

On command line run godoc &lt;pkg name&gt;, example godoc encoding/json.

By the way, you can also get Java library sources so using javap for this is definitely not the shortest path. It also have documentation available online https://docs.oracle.com/javase/8/docs/api/

huangapple
  • 本文由 发表于 2015年6月19日 14:16:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/30931142.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定