当前位置:网站首页>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
边栏推荐
- PowerPoint tutorial, how to save a presentation as a video in PowerPoint?
- [quantitative trading] permanent portfolio, turtle trading rules reading, back testing and discussion
- Spark实战1:单节点本地模式搭建Spark运行环境
- 挡不住了,国产芯片再度突进,部分环节已进到4nm
- 【556. 下一个更大元素 III】
- Unity render streaming communicates with unity through JS
- MySQL 数据处理值增删改
- Comprehensive evaluation of double chain notes remnote: fast input, PDF reading, interval repetition / memory
- CVPR 2022 | interpretation of 6 excellent papers selected by meituan technical team
- AI 考高数得分 81,网友:AI 模型也免不了“内卷”!
猜你喜欢

SQL Injection (AJAX/JSON/jQuery)

太阳底下无新事,元宇宙能否更上层楼?

User and group command exercises

AI 考高数得分 81,网友:AI 模型也免不了“内卷”!

Resource Cost Optimization Practice of R & D team

DQL basic query

Resolved (error in viewing data information in machine learning) attributeerror: target_ names

Libuv Library - Design Overview (Chinese version)

Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.

The latest BSC can pay dividends. Any B usdt Shib eth dividend destruction marketing can
随机推荐
Several common optimization methods matlab principle and depth analysis
[技術發展-24]:現有物聯網通信技術特點
The R language GT package and gtextras package gracefully and beautifully display tabular data: nflreadr package and gt of gtextras package_ plt_ The winloss function visualizes the win / loss values
Asp.Net Core1.1版本没了project.json,这样来生成跨平台包
SQL Injection (AJAX/JSON/jQuery)
Unity Render Streaming通过Js与Unity自定义通讯
Kivy教程之 如何通过字符串方式载入kv文件设计界面(教程含源码)
Mobile phones and computers can be used, whole people, spoof code connections, "won't you Baidu for a while" teach you to use Baidu
[技术发展-24]:现有物联网通信技术特点
Tutoriel PowerPoint, comment enregistrer une présentation sous forme de vidéo dans Powerpoint?
树的深入和广度优先遍历(不考虑二叉树)
json序列化时案例总结
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
刚毕业的欧洲大学生,就能拿到美国互联网大厂 Offer?
untiy世界边缘的物体阴影闪动,靠近远点的物体阴影正常
Swiftui development experience: the five most powerful principles that a programmer needs to master
Today's sleep quality record 77 points
Internet of things completion -- (stm32f407 connects to cloud platform detection data)
MySQL functions and related cases and exercises
Spark practice 1: build spark operation environment in single node local mode