go-zero
go-zero copied to clipboard
打包生成Linux执行文件.总是报错:config file etc/****.yaml, field "Host" is not set 2024/07/01
如题,本机环境为windows11。 本地debug、打包成.exe文件执行均正常 但是打包成Linux程序时,总是报错: config file etc/****.yaml, field "Host" is not set 2024/07/01 配置添加了Host也不行。升级成1.6.6之后还是报错: 16:29:18 error: config file etc/centerrpc.yaml, field "Cache[1].Host" is not set
换成mac进行打包也不行。最后打开源码找到了/stores/redis/conf.go文件,发现Conf定义如下:
// A RedisConf is a redis config.
RedisConf struct {
Host string
Type string json:",default=node,options=node|cluster"
Pass string json:",optional"
Tls bool json:",optional"
NonBlock bool json:",default=true"
// PingTimeout is the timeout for ping redis.
PingTimeout time.Duration json:",default=1s"
}
怀疑Host没有添加tag而导致的错误,到本地进行修改:
Host string json:",default=127.0.0.1"
打包,上传,执行,成功!
足足让我折腾了三天 你们这也太坑了,怎么还能漏这个?