Fix the broken url in /pkg (#280)

This commit is contained in:
Jim Chien
2025-12-12 13:01:50 +08:00
committed by GitHub
parent 2523880930
commit 9690e8a8dc
21 changed files with 21 additions and 21 deletions

View File

@@ -69,7 +69,7 @@ Go 1.14 [`Go Modules`](https://go.dev/wiki/Modules) 终于可以投入生产了
### `/pkg`
外部应用程序可以使用的库代码(例如 `/pkg/mypubliclib`)。其他项目会导入这些库,希望它们能正常工作,所以在这里放东西之前要三思:-)注意,`internal` 目录是确保私有包不可导入的更好方法,因为它是由 Go 强制执行的。`/pkg` 目录仍然是一种很好的方式可以显式地表示该目录中的代码对于其他人来说是安全使用的好方法。由 Travis Jeffery  撰写的 [`I'll take pkg over internal`](https://travisjeffery.com/b/2019/11/i-ll-take-pkg-over-internal/) 博客文章提供了 `pkg``internal` 目录的一个很好的概述,以及什么时候使用它们是有意义的。
外部应用程序可以使用的库代码(例如 `/pkg/mypubliclib`)。其他项目会导入这些库,希望它们能正常工作,所以在这里放东西之前要三思:-)注意,`internal` 目录是确保私有包不可导入的更好方法,因为它是由 Go 强制执行的。`/pkg` 目录仍然是一种很好的方式可以显式地表示该目录中的代码对于其他人来说是安全使用的好方法。由 Travis Jeffery  撰写的 [`I'll take pkg over internal`](https://travisjeffery.com/ill-take-pkg-over-internal/) 博客文章提供了 `pkg``internal` 目录的一个很好的概述,以及什么时候使用它们是有意义的。
当根目录包含大量非 Go 组件和目录时,这也是一种将 Go 代码分组到一个位置的方法,这使得运行各种 Go 工具变得更加容易(正如在这些演讲中提到的那样: 来自 GopherCon EU 2018 的 [`Best Practices for Industrial Programming`](https://www.youtube.com/watch?v=PTE4VJIdHPg) , [GopherCon 2018: Kat Zien - How Do You Structure Your Go Apps](https://www.youtube.com/watch?v=oL6JBUk6tj0) 和 [GoLab 2018 - Massimiliano Pippi - Project layout patterns in Go](https://www.youtube.com/watch?v=3gQa1LWwuzk) )。