1
0
mirror of https://github.com/chai2010/go2-book.git synced 2025-06-07 01:58:35 +00:00
This commit is contained in:
chai2010 2019-02-27 15:26:04 +08:00
parent 9a0a21f3d8
commit 4d9d43bb7d
7 changed files with 53 additions and 1 deletions

View File

@ -38,4 +38,4 @@
| 支付宝 | 微信 |
|:-----:|:-----:|
|![alipay](images/donate-alipay-github-chai2010.jpg)|![weixin](images/donate-weixin-github-chai2010.jpg)|
|![alipay](images/donate-alipay-github-chai2010-20yuan.jpg)|![weixin](images/donate-weixin-github-chai2010-20yuan.jpg)|

50
ch2/ch2-1.md Normal file
View File

@ -0,0 +1,50 @@
# 2.1 Go包机制
<!--
1.
语言只定义了包的概念
包可以有不同的实现比如基于zip的包集合
最早是没有gopath的
makefile时代的编译和goroot是放在一起的
2.
gopath
intrnal
vendor
和std同名的包
3.
vendor的问题
本质原因是不同包中的类型不一样
vendor内的包对应新路径的包
4. 模块的设计⽬标
问题,有时候需要调试,临时修改以来包的代码,
但是修改之后会导致其它依赖此包的应用被影响可以用replace吗
5. 模块快速⼊⻔
6. go.mod 和 go.sum⽂件
7. go get重新⼊⻔
8. 语义化版本号
9. v1/v2/v3版本共存
10. ⼦模块
11. 最⼩化版本选择
12. 版本不相容和间接依赖
13. go mod命令
14. 私有仓库/镜像
以前是每个pkg的go get需要DNS查网址如果要定制指南修改hosts文件
但是修改hosts文件将对其它应用产生影响。
-->

View File

@ -1 +1,3 @@
# 第2章 模块化
TODO

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB