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

[Fix] 修复当调用 repository.go 中 GetXXXValue,类型不一致时的报错 #216

Merged
merged 2 commits into from
Mar 21, 2022

Conversation

zouyx
Copy link
Member

@zouyx zouyx commented Mar 19, 2022

@zouyx zouyx added the bug label Mar 19, 2022
@zouyx zouyx self-assigned this Mar 19, 2022
@mergify
Copy link
Contributor

mergify bot commented Mar 19, 2022

感谢您提出Pull Request,我会尽快Review。我会在1-2日内进行查看或者回复,如果遇到节假日可能会处理较慢,敬请谅解。

@zouyx zouyx linked an issue Mar 19, 2022 that may be closed by this pull request
return defaultValue
}
return i
return value.(int)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if there is any error happened in type conversion, we need to log the error and return the default value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are right :)

I had fixed it.

@zouyx zouyx changed the title [Fix] 修复获取 bool、int、float64 报错 [Fix] 修复当调用 repository.go 中 GetXXXValue,类型不一致时的报错 Mar 20, 2022
@@ -195,89 +193,37 @@ func (c *internalClient) GetApolloConfigCache() agcache.CacheInterface {

//GetValue 获取配置
func (c *internalClient) GetValue(key string) string {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method is get default namespace for compatible old version, below as also.

@@ -49,11 +49,11 @@ func createMockApolloConfig(expireTime int) *internalClient {
//string
configs["string"] = "value"
//int
configs["int"] = "1"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong case ,so change it

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mergify mergify bot merged commit 1b248f2 into develop Mar 21, 2022
@nobodyiam nobodyiam deleted the hotfix/fixGetBoolValue branch March 21, 2022 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] yaml格式namespace取值报错
2 participants