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

# 24 包

Go语言中的一个包(package)表示相关联的代码组成的一个单元，其他语言通常称它们为库(libraries)。

一个包由单个目录中的多个文件组成，目录和包之间是一对一映射关系。

在单个代码库中，可以有多个包。

Go语言的标准库通常就是由一组包提供的。

一个包是通过它的导入路径标识的，例如`github.com/gomarkdown/markdown`就是解析markdown格式的包的导入路径。
