最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【整理】go语言的学习参考资料

GO crifan 2296浏览 0评论

此处整理一些,go语言的API文档,学习资料,参考资料,有价值的资料等等。

 

go语言学习资料

 

Go by Example

英文的。

网址:https://gobyexample.com/

通过例子,一点点学习。

教程写的言简意赅,十分适合初学者,一点一点,循序渐进的学习go的语法。

 

 

go语言的所有的模块的文档

后来才发现,其实官网中:

Directory /src/pkg

http://golang.org/pkg/

中,就罗列了,所有的,go语言的内置的库。

所以,等你需要的时候,就可以去查看其解释说明了。

比如,想要查看关于http相关的库,就可以看到,和网络net相关的所有的库:

net    Package net provides a portable interface for network I/O, including TCP/IP, UDP, domain name resolution, and Unix domain sockets.
     http    Package http provides HTTP client and server implementations.
          cgi    Package cgi implements CGI (Common Gateway Interface) as specified in RFC 3875.
          cookiejar    Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
          fcgi    Package fcgi implements the FastCGI protocol.
          httptest    Package httptest provides utilities for HTTP testing.
          httputil    Package httputil provides HTTP utility functions, complementing the more common ones in the net/http package.
          pprof    Package pprof serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.
     mail    Package mail implements parsing of mail messages.
     rpc    Package rpc provides access to the exported methods of an object across a network or other I/O connection.
          jsonrpc    Package jsonrpc implements a JSON-RPC ClientCodec and ServerCodec for the rpc package.
     smtp    Package smtp implements the Simple Mail Transfer Protocol as defined in RFC 5321.
     textproto    Package textproto implements generic support for text-based request/response protocols in the style of HTTP, NNTP, and SMTP.
     url    Package url parses URLs and implements query escaping.

然后,就可以,根据需要,自己去查阅相关的说明了。

 

go语言安装后,本身已经自带了相关的示例代码,函数api说明

如上,各种go语言的库的解释说明,相关的示例代码,等等。

都是go官网中,在线浏览查看的。

其实,go语言安装后,本身已经自带了这些内容:

go-programming-language-godocserver_

然后其会启动一个本身的网页服务器:

godoc-server-http-localhost-6060_thu

然后会打开对应的网页:

localhost-6060-can-see-all-that-in-o

可见,其中已经包含了,所有的原先只能在线看的那些文档资料。

比如点击对应的Package后,同样可以进入:

include-offline-pkg-doc_thumb

同样可以去查阅所有的api的库函数说明。

至此,余下的,就是自己去查找不同的库,搞懂如何使用了。

 

go官网模块的在线文档中,有的函数是有示例代码可供参考的

比如:

Package path

打开页面,没看到有什么示例代码,所以一直以为go的在线文档,只有函数接口说明,没示例代码的。

后来无意间发现,其示例代码,是在函数解析下面的,默认是隐藏起来的。

比如:

func Base

其解释说明下面,有个:

▹ Example

的,点击后,就可以看到对应的是示例代码了:

click example show sample code

所以:

go语言在线文档中,不是没有示例代码;

而只是默认时候,没显示出来,需要你点击一下才显示。。。。

 

注:

不是所有的函数,都有示例代码的。

 

点击在线文档中的函数,可以看到完整的代码实现

如图:

mouse move to func show url of code

鼠标移动到对应函数名上,可以看到对应的地址,点击进入该地址后,可以看到完整的该函数的代码实现:

go into that func url can see real full code

即:

感兴趣的,可以去看看go中某函数的代码实现的。

至少很很大的参考价值的。

 

The-Golang-Standard-Library-by-Example

中文的。

go官网的是给出了API,但是很多的api中,都没有示例代码,导致很多api都不会用。

此处,作者翻译(还没全部翻译完成)了官网的api,且给出了示例代码。

对于想要搞清楚api如何使用,很有参考价值。

转载请注明:在路上 » 【整理】go语言的学习参考资料

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
89 queries in 0.170 seconds, using 22.10MB memory