英文:
Install go package with dependencies
问题
我在gopath配置方面遇到了一些问题。我已经解决了go路径的问题。但是出现了以下错误...
[root@localhost mysqlbeat]# go get github.com/adibendahan/mysqlbeat
github.com/adibendahan/mysqlbeat/beater
/root/go/src/src/github.com/adibendahan/mysqlbeat/beater/mysqlbeat.go:289:7: b.Events undefined (type *beat.Beat has no field or method Events)
/root/go/src/src/github.com/adibendahan/mysqlbeat/beater/mysqlbeat.go:303:7: b.Events undefined (type *beat.Beat has no field or method Events)
/root/go/src/src/github.com/adibendahan/mysqlbeat/beater/mysqlbeat.go:326:5: b.Events undefined (type *beat.Beat has no field or method Events)
我应该如何正确安装go包以及其所有依赖项?
更新:
我下载了该包并尝试运行它。这次出现了不同的错误...
[root@localhost mysqlbeat]# make
go build
can't load package: /root/go/src/src/github.com/adibendahan/mysqlbeat/main.go:8:2: non-standard import "github.com/adibendahan/mysqlbeat/beater" in standard package "src/github.com/adibendahan/mysqlbeat"
make: *** [build] Error 1
英文:
I had some issues with gopath configuration. I was able to resolve the go path issue. But getting this error...
[root@localhost mysqlbeat]# go get github.com/adibendahan/mysqlbeat
# github.com/adibendahan/mysqlbeat/beater
/root/go/src/src/github.com/adibendahan/mysqlbeat/beater/mysqlbeat.go:289:7: b.Events undefined (type *beat.Beat has no field or method Events)
/root/go/src/src/github.com/adibendahan/mysqlbeat/beater/mysqlbeat.go:303:7: b.Events undefined (type *beat.Beat has no field or method Events)
/root/go/src/src/github.com/adibendahan/mysqlbeat/beater/mysqlbeat.go:326:5: b.Events undefined (type *beat.Beat has no field or method Events)
How do I correctly install go package along with all it's dependencies?
Update:
I downloaded the package and tried to run it.Different error this time...
[root@localhost mysqlbeat]# make
go build
can't load package: /root/go/src/src/github.com/adibendahan/mysqlbeat/main.go:8:2: non-standard import "github.com/adibendahan/mysqlbeat/beater" in standard package "src/github.com/adibendahan/mysqlbeat"
make: *** [build] Error 1
答案1
得分: 1
请查看 mysqlbeat
的 README.md
文件中的 构建说明 部分。
mysqlbeat
使用 Glide 进行依赖管理。请参考此链接安装 Glide。
在安装 Glide 后,克隆 mysqlbeat
仓库并运行以下命令:
$ glide update --no-recursive
$ make
如果您仍然希望通过 go get
导入此仓库,请先克隆该仓库,然后在其根目录下运行 go get ./...
。
英文:
Check out the How to Build section on README.md
on mysqlbeat
.
mysqlbeat
uses Glide for dependency management. Check this for installing glide.
After installing Glide, clone the mysqlbeat
repository and run:
$ glide update --no-recursive
$ make
If you still want to import this repository by go get
, clone the repo and then run go get ./...
from its root directory.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论