我正在运行go build
要go.mod
使用库“ github.com/gocolly/colly v1.2.0”更新我的文件,但是我看到所有其他依赖项最后都说“ //间接”。如何避免这种情况?这是我的go.mod文件
module prodenv
go 1.13
require (
github.com/PuerkitoBio/goquery v1.5.1 // indirect
github.com/antchfx/htmlquery v1.2.2 // indirect
github.com/antchfx/xmlquery v1.2.3 // indirect
github.com/antchfx/xpath v1.1.5 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gocolly/colly v1.2.0
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/kennygrant/sanitize v1.2.4 // indirect
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect
github.com/temoto/robotstxt v1.1.1 // indirect
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect
google.golang.org/appengine v1.6.5 // indirect
)
不幸的是,你无法避免。间接依赖关系,基本上是未在go.mod
直接依赖关系中列出的依赖关系,但仍然需要它。
在您的情况下,它会发生,因为您将其github.com/gocolly/colly v1.2.0
用作依赖项,并且v1.2.0
此软件包不是模块,因为它不包含go.mod
,所以它的所有依赖项都是间接的,并在go.mod
withindirect
标记中列出。
请注意,它colly
具有go.mod
> = v2.0.0,因此,如果您需要该版本,则这些依赖项不会在您的中被列为间接的go.mod
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句