du9826 2019-04-22 01:31
浏览 4726
已采纳

使用go mod下载时,什么会导致“模式匹配任何模块依赖性”?

When running go mod download the warning (warning: pattern "all" matched no module dependencies) is shown and none of the modules in my go.mod file are download to the local cache.

I've spent the last hour on google trying to find similar errors but have been stuck with the only results being broken CI build logs.

My go.mod file is as follows:

module github.com/j4ng5y/scraper-api

go 1.12

require (
    github.com/PuerkitoBio/goquery v1.5.0 // indirect
    github.com/antchfx/htmlquery v1.0.0 // indirect
    github.com/antchfx/xmlquery v1.0.0 // indirect
    github.com/antchfx/xpath v0.0.0-20190319080838-ce1d48779e67 // indirect
    github.com/go-yaml/yaml v2.1.0+incompatible
    github.com/gobwas/glob v0.2.3 // indirect
    github.com/gocolly/colly v1.2.0 // indirect
    github.com/gorilla/mux v1.7.1
    github.com/kennygrant/sanitize v1.2.4 // indirect
    github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect
    github.com/temoto/robotstxt v0.0.0-20180810133444-97ee4a9ee6ea // indirect
    golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 // indirect
    google.golang.org/appengine v1.5.0 // indirect
)

I would expect go mod download to pull all of the modules to the local cache but instead I get the warning and nothing is downloaded.

  • 写回答

3条回答 默认 最新

  • dongxing6802 2019-04-22 17:03
    关注

    Try enabling go modules. This works for me with go 1.12

    GO111MODULE=on go mod download
    

    Note: If you're working inside $GOPATH/src, go modules are disabled by default and can be enabled by setting GO111MODULE=on.

    From https://blog.golang.org/using-go-modules,

    (Inside $GOPATH/src, for compatibility, the go command still runs in the old GOPATH mode, even if a go.mod is found. See the go command documentation for details.)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮