未定义:testcontainers-go 中的 p.client.DaemonHost
时间:2024-03-23
浏览:189
作者:佚名
在使用 glide 集成 testcontainers-go v0.0.3 时,遇到 "p.client.DaemonHost undefined" 错误。该错误可能是由于 glide 过时,建议使用 go 模块,并在 go.mod 文件中添加依赖项,例如:require (github.com/testcontainers/testcontainers-go v0.12.0)。
我正在尝试将 testcontainers-go 添加到我的项目中。我使用 github 自述文件中的 glide 和 testnginxlatestreturn 示例。
在滑翔中我放了
- package: github.com/testcontainers/testcontainers-go version: v0.0.3
但在运行时我在 idea 中收到此错误。
# github.com/testcontainers/testcontainers-go ../../../../../../pkg/mod/github.com/testcontainers/[email protected]/docker.go:326:32: p.client.DaemonHost undefined (type *client.Client has no field or method DaemonHost)
知道我为什么会遇到这个问题以及如何解决它吗?
解决方案
您尝试过 go 模块吗?我注意到 glide 的最后一次提交是 2'5 年前的,不确定你是否还在使用它。
对于 go 模块,只需将依赖项添加到 go.mod 文件即可。像这样的事情:
require (
github.com/testcontainers/testcontainers-go v0.12.0
)
您可以在项目文档中找到有关安装它的更多信息:https://golang.testcontainers.org/quickstart
与 glide 的当前错误相关,testcontainers-go v0.0.3 (docker/docker-v0.7.3) 中的 docker 依赖项似乎应包含 client.daemonhost 方法,该方法于 2017 年 5 月 22 日在 https://github.com/moby/moby/commit/6ce6ae1cd11d888e0c8ede20926b86981cee5ce1 中添加。
我建议您使用较新版本的库(v0.12.0)
终于介绍完啦!小伙伴们,这篇关于《未定义:testcontainers-go 中的 p.client.DaemonHost》的介绍应该让你收获多多了吧!欢迎大家收藏或分享给更多需要学习的朋友吧~golang学习网公众号也会发布Golang相关知识,快来关注吧!
本文内容来源于互联网,如有侵权请联系删除。
近期热门
站内热门
最新文章
热门专题
