-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
打包生成Linux执行文件.总是报错:config file etc/****.yaml, field "Host" is not set 2024/07/01 #4223
Comments
Not the problem, you add You need to set Would you please show me the content of your centerrpc.yaml? Or is your path correct? |
其实up主的意思就是 Host必填,其它要不可选或者使用默认, 不过提示信息应该更准确一些(包含一些上下文信息) |
In fact, the main meaning of up is that Host is required. Others should be optional or use the default. However, the prompt information should be more accurate (including some contextual information) |
这是我的配置文件内容: 我是使用标准模板生成的项目工程,所以每个.yaml配置文件我都肯定填写了Host地址,而且修改了好几次(因为提示确实一开始就指向了Host的配置):0.0.0.0或者127.0.0.1 |
16:29:18 error: config file etc/centerrpc.yaml, field "Cache[1].Host" is not set 这个行数应该说的是你cache 缓存配置那里没写host 吧? 如果模板生成的应该是第二行默认给了值的 |
16:29:18 error: config file etc/centerrpc.yaml, field "Cache[1].Host" is not set This number of lines should mean that you did not write host in the cache configuration, right? If the template generates it, it should be the value given by default in the second line. |
如题,本机环境为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"
打包,上传,执行,成功!
足足让我折腾了三天
你们这也太坑了,怎么还能漏这个?
The text was updated successfully, but these errors were encountered: