1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-11-24 08:02:32 +02:00

[fix] ignore unexported field (#2354)

ignore unexported field when register endpoints
This commit is contained in:
Johnson C 2021-11-18 17:07:00 +08:00 committed by GitHub
parent 4f1a571704
commit 90b3e4af0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -29,6 +29,9 @@ func extractValue(v reflect.Type, d int) *registry.Value {
case reflect.Struct:
for i := 0; i < v.NumField(); i++ {
f := v.Field(i)
if !f.IsExported() {
continue
}
val := extractValue(f.Type, d+1)
if val == nil {
continue

View File

@ -74,6 +74,9 @@ func extractValue(v reflect.Type, d int) *registry.Value {
case reflect.Struct:
for i := 0; i < v.NumField(); i++ {
f := v.Field(i)
if !f.IsExported() {
continue
}
val := extractValue(f.Type, d+1)
if val == nil {
continue

View File

@ -29,6 +29,9 @@ func extractValue(v reflect.Type, d int) *registry.Value {
case reflect.Struct:
for i := 0; i < v.NumField(); i++ {
f := v.Field(i)
if !f.IsExported() {
continue
}
val := extractValue(f.Type, d+1)
if val == nil {
continue