当前位置:网站首页>Go 1.16.4: manage third-party libraries with Mod
Go 1.16.4: manage third-party libraries with Mod
2022-07-03 13:48:00 【Lao Liu, you are so awesome】
One , View the available versions of a third-party library :
Here to gin For example :
[email protected]:~$ go list -m -versions github.com/gin-gonic/gin
github.com/gin-gonic/gin v1.1.1 v1.1.2 v1.1.3 v1.1.4 v1.3.0 v1.4.0
v1.5.0 v1.6.0 v1.6.1 v1.6.2 v1.6.3 v1.7.0 v1.7.1 v1.7.2 explain : Liu Hongdi's go The forest is a focus golang The blog of ,
Address :https://blog.csdn.net/weixin_43881017
explain : author : Liu Hongdi mailbox : [email protected]
Two , View the locally downloaded version :
[email protected]:~$ ls /home/liuhongdi/go/pkg/mod/github.com/gin-gonic
[email protected] [email protected]explain :/home/liuhongdi/go/pkg/mod yes GOMODCACHE The path of ,
Used to save third-party libraries
example :
[email protected]:~$ go env
...
GOMODCACHE="/home/liuhongdi/go/pkg/mod"3、 ... and , Download the specified version of the third-party library :
explain : stay @ Later specified version
[email protected]:~$ go get github.com/gin-gonic/[email protected]
go: downloading github.com/gin-gonic/gin v1.7.1Check the effect after downloading :
[email protected]:~$ ls /home/liuhongdi/go/pkg/mod/github.com/gin-gonic
[email protected] [email protected] [email protected]Four , Download the latest version of the third-party library :
[email protected]:~$ go get -u github.com/gin-gonic/gin
…See the effect :
[email protected]:~$ ls /home/liuhongdi/go/pkg/mod/github.com/gin-gonic
[email protected] [email protected] [email protected] [email protected]5、 ... and , Use the specified version of the third-party library in the project :
explain : It needs to be operated under the project directory
Check out the original version :
[email protected]:/data/liuhongdi/digv01$ more go.mod
module github.com/liuhongdi/digv01
go 1.16
require (
github.com/gin-gonic/gin v1.6.3
github.com/jinzhu/gorm v1.9.16
)Specify the use of v1.7.2 edition
[email protected]:/data/liuhongdi/digv01$ go get github.com/gin-gonic/[email protected]
[email protected]:/data/liuhongdi/digv01$ more go.mod
module github.com/liuhongdi/digv01
go 1.16
require (
github.com/gin-gonic/gin v1.7.2
github.com/jinzhu/gorm v1.9.16
)6、 ... and , View all dependencies of the third-party library of the specified project :
explain : It needs to be operated under the project directory
[email protected]:/data/liuhongdi/digv01$ go list -m all
github.com/liuhongdi/digv01
github.com/PuerkitoBio/goquery v1.5.1
github.com/andybalholm/cascadia v1.1.0
...7、 ... and , Manually remove a dependency from the project :
see go.mod
[email protected]:/data/liuhongdi/digv01$ more go.mod
module github.com/liuhongdi/digv01
go 1.16
require (
github.com/gin-gonic/gin v1.7.0
github.com/jinzhu/gorm v1.9.16
)Delete
# -droprequire: Specify the dependencies to remove
[email protected]:/data/liuhongdi/digv01$ go mod edit -droprequire=github.com/gin-gonic/ginSee the effect
[email protected]:/data/liuhongdi/digv01$ more go.mod
module github.com/liuhongdi/digv01
go 1.16
require github.com/jinzhu/gorm v1.9.168、 ... and , Add a dependency manually in the project :
explain : Version required
# -require: Specify the dependencies to add
[email protected]:/data/liuhongdi/digv01$ go mod edit -require=github.com/gin-gonic/[email protected]See the effect
[email protected]:/data/liuhongdi/digv01$ more go.mod
module github.com/liuhongdi/digv01
go 1.16
require (
github.com/gin-gonic/gin v1.7.1
github.com/jinzhu/gorm v1.9.16
)explain : And execute under the project directory go get The same command
Nine , see go Version of :
[email protected]:/data/go/mod3$ go version
go version go1.16.4 linux/amd64
边栏推荐
- MySQL installation, uninstallation, initial password setting and general commands of Linux
- NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
- Can newly graduated European college students get an offer from a major Internet company in the United States?
- Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:
- 记录关于银行回调post请求405 问题
- 【被动收入如何挣个一百万】
- Spark实战1:单节点本地模式搭建Spark运行环境
- Complete deep neural network CNN training with tensorflow to complete picture recognition case 2
- [技术发展-24]:现有物联网通信技术特点
- Depth and breadth first traversal of tree (regardless of binary tree)
猜你喜欢

Golang — 命令行工具cobra
![[understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered](/img/06/b71b505c7072d540955fda6da1dc1b.jpg)
[understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered

MySQL functions and related cases and exercises

Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station

CVPR 2022 | 美团技术团队精选6篇优秀论文解读

Several common optimization methods matlab principle and depth analysis

又一个行业被中国芯片打破空白,难怪美国模拟芯片龙头降价抛售了

Another industry has been broken by Chinese chips. No wonder the leading analog chip companies in the United States have cut prices and sold off

Flutter dynamic | fair 2.5.0 new version features

CVPR 2022 | interpretation of 6 excellent papers selected by meituan technical team
随机推荐
Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.
RichView TRVStyle ListStyle 列表样式(项目符号编号)
【556. 下一个更大元素 III】
IBEM 数学公式检测数据集
Golang — 命令行工具cobra
Universal dividend source code, supports the dividend of any B on the BSC
MySQL functions and related cases and exercises
太阳底下无新事,元宇宙能否更上层楼?
Brief analysis of tensorboard visual processing cases
Golang — template
Disruptor -- a high concurrency and high performance queue framework for processing tens of millions of levels
Unity render streaming communicates with unity through JS
Replace the GPU card number when pytorch loads the historical model, map_ Location settings
Spark practice 1: build spark operation environment in single node local mode
Logback log sorting
Multi table query of MySQL - multi table relationship and related exercises
Error running 'application' in idea running: the solution of command line is too long
Another industry has been broken by Chinese chips. No wonder the leading analog chip companies in the United States have cut prices and sold off
记录关于银行回调post请求405 问题
PHP maze game