Skip to content
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

Open
zenghnn opened this issue Jul 1, 2024 · 3 comments

Comments

@zenghnn
Copy link

zenghnn commented Jul 1, 2024

如题,本机环境为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"
打包,上传,执行,成功!

足足让我折腾了三天
你们这也太坑了,怎么还能漏这个?

@kevwan
Copy link
Contributor

kevwan commented Jul 2, 2024

Not the problem, you add json:",default=127.0.0.1" is just using default value.

You need to set Host value in your config file.

Would you please show me the content of your centerrpc.yaml? Or is your path correct?

@Owen-Zhang
Copy link

其实up主的意思就是 Host必填,其它要不可选或者使用默认, 不过提示信息应该更准确一些(包含一些上下文信息)

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants