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:generic struct2MapAll #822

Merged
merged 5 commits into from
Oct 31, 2020
Merged

Conversation

fangyincheng
Copy link
Contributor

What this PR does:

fix generic struct2MapAll

Which issue(s) this PR fixes:

Fixes #801

Copy link
Member

@zouyx zouyx left a comment

Choose a reason for hiding this comment

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

Check fail bro

@zouyx zouyx added this to the v1.5.4 milestone Oct 30, 2020
@zouyx zouyx linked an issue Oct 30, 2020 that may be closed by this pull request
@codecov-io
Copy link

codecov-io commented Oct 30, 2020

Codecov Report

Merging #822 into develop will increase coverage by 0.28%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #822      +/-   ##
===========================================
+ Coverage    59.85%   60.14%   +0.28%     
===========================================
  Files          260      260              
  Lines        12762    12770       +8     
===========================================
+ Hits          7639     7680      +41     
+ Misses        4164     4133      -31     
+ Partials       959      957       -2     
Impacted Files Coverage Δ
filter/filter_impl/generic_filter.go 72.13% <100.00%> (+3.61%) ⬆️
registry/kubernetes/registry.go 52.17% <0.00%> (-5.44%) ⬇️
...tocol/rest/server/server_impl/go_restful_server.go 46.51% <0.00%> (-4.66%) ⬇️
metadata/report/delegate/delegate_report.go 38.98% <0.00%> (-0.85%) ⬇️
registry/zookeeper/service_discovery.go 81.20% <0.00%> (-0.76%) ⬇️
config_center/nacos/client.go 67.36% <0.00%> (+2.10%) ⬆️
remoting/getty/getty_client.go 46.59% <0.00%> (+6.81%) ⬆️
remoting/getty/listener.go 42.95% <0.00%> (+7.04%) ⬆️
remoting/getty/pool.go 69.60% <0.00%> (+9.42%) ⬆️
config_center/nacos/facade.go 89.65% <0.00%> (+10.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9eb7c01...5ab9ccb. Read the comment docs.

if v.Field(i).Kind() == reflect.Struct || v.Field(i).Kind() == reflect.Slice || v.Field(i).Kind() == reflect.Map {
switch v.Field(i).Kind() {
case reflect.Struct:
fallthrough
Copy link
Member

Choose a reason for hiding this comment

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

骚气蓬勃的用法,方哥。

Copy link
Contributor

Choose a reason for hiding this comment

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

用法没问题,但是会降低执行效率

@zouyx zouyx added the bug Something isn't working label Oct 31, 2020
if value.CanInterface() {
if value.Type().String() == "time.Time" {
setInMap(result, field, value.Interface())
break
Copy link
Contributor

Choose a reason for hiding this comment

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

should be continue

kind := value.Kind()
if kind == reflect.Struct || kind == reflect.Slice || kind == reflect.Map {
if value.CanInterface() {
if value.Type().String() == "time.Time" {
Copy link
Contributor

@wongoo wongoo Oct 31, 2020

Choose a reason for hiding this comment

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

use a type check expression would be better: switch v := param.(type), I think there are other structs will be added, especially these in golang sdk.

@AlexStocks AlexStocks merged commit e10fd2f into apache:develop Oct 31, 2020
zouyx pushed a commit to zouyx/dubbo-go that referenced this pull request Oct 31, 2020
@zouyx zouyx changed the title fix generic struct2MapAll Fix:generic struct2MapAll Nov 1, 2020
@fangyincheng fangyincheng deleted the fix-generic branch November 15, 2020 04:44
AlexStocks added a commit that referenced this pull request Apr 14, 2021
AlexStocks added a commit that referenced this pull request Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment