-
Notifications
You must be signed in to change notification settings - Fork 2
build
黄孟柱 edited this page Jul 18, 2019
·
1 revision
因为golang的plugin存在的问题,插件的编译环境需要满足如下三个条件才能正常被goku网关加载运行
- 与网关节点使用相同的go版本
- 与网关节点使用相同的GOPATH目录
- 与网关节点如果有相同的依赖,必须版本一致
plugin机制只能运行于linux/macos两种系统,不支持windows
-
请与服务人员联系确定你使用的网关的go版本
-
为解决GOPATH问题,官方在编译时使用/tmp/GOPATH_GOKU 目录作为GOPATH
-
推荐使用GOMODULE来解决依赖包版本的问题,请与服务人员确定你用的网关的 goku-plugin 的版本,其他的依赖包无法预估,在后面的网关版本中会提供完全的依赖包冲突的检查功能
如下脚本可以正确编译接口说明中的 customer-example.go go.mod
module demo/plugin/customer-example
go 1.12
require github.com/eolinker/goku-plugin v0.1.0
#cd $root
TMPPATH="/tmp/GOPATH_GOKU"
export GOPATH=${TMPPATH}
#go mod init customer-example
#go get -v github.com/eolinker/goku-plugin@v0.1.0
go build --buildmode=plugin -o ${OUT}/customer-example.so