安装带有依赖项的Go包。

huangapple go评论75阅读模式
英文:

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

请查看 mysqlbeatREADME.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.

huangapple
  • 本文由 发表于 2017年9月10日 13:09:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/46137490.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定