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

启动加载yaml配置文件,role、type字段支持类型判断 #3

Closed
mark1995 opened this issue Dec 13, 2021 · 1 comment
Closed

Comments

@mark1995
Copy link
Contributor

mark1995 commented Dec 13, 2021

func (t *DataSourceType) UnmarshalText(text []byte) error {
	if t == nil {
		return errors.New("can't unmarshal a nil *DataSourceRole")
	}
	if t.unmarshalText(bytes.ToLower(text)) {
		return fmt.Errorf("unrecognized protocal type: %q", text)
	}
	return nil
}

What happened:
支持的角色类型、协议类型,返回了error的错误
What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

if t.unmarshalText(bytes.ToLower(text)) {
		return fmt.Errorf("unrecognized protocal type: %q", text)
	}

改为

if !t.unmarshalText(bytes.ToLower(text)) {
		return fmt.Errorf("unrecognized protocal type: %q", text)
	}

Anything else we need to know?:

@dk-lockdown
Copy link
Contributor

提个 pr 修复下哇,另外 error 的提示也有问题, DataSourceRole 提示的是 unrecognized protocal type

dk-lockdown added a commit that referenced this issue Dec 15, 2021
修复解析配置role、type字段 fix #3
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

Successfully merging a pull request may close this issue.

2 participants