> For the complete documentation index, see [llms.txt](https://wskdsgcf.gitbook.io/mastering-go-zh-cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wskdsgcf.gitbook.io/mastering-go-zh-cn/06.0.md).

# 6 Go package中不为人知的知识

上章，我们讨论了开发和使用自定义数据结构，如链表，字节树，哈希表，还有生产随机数和用 Go 猜测密码。

这章主要讲 Go package，它是 Go 组织，交付，使用代码的方式。Go package 非常通用的组成部分是 **函数**，它相当的灵活。这章的最后部分您将看到一些高级的 Go 标准库 package，会更好地理解创建 Go package 的不同方式。

这章，您将了解到如下主题：

* 用 Go 编写函数
* 匿名函数
* 返回多值函数
* 命名函数的返回值
* 返回其他函数的函数
* 函数作为参数的函数
* 编写 Go package
* 私有和公有 package 对象
* 在包中使用 `init()` 函数
* 复杂的 `html/templates` 标准 package
* `text/template` 标准 package，和另一个真正复杂的有自己语言的 Go package
* `syscall` 标准包，它是一个底层的包，尽管您可能很少有机会使用它，但它被其他包广泛使用。
