Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: unistack-org/micro
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.3.14
Choose a base ref
...
head repository: unistack-org/micro
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.3.15
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Apr 19, 2021

  1. util/reflect: fix protobuf field name detection

    Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
    vtolstov committed Apr 19, 2021
    Copy the full SHA
    852f195 View commit details
Showing with 10 additions and 5 deletions.
  1. +10 −5 util/reflect/reflect.go
15 changes: 10 additions & 5 deletions util/reflect/reflect.go
Original file line number Diff line number Diff line change
@@ -70,7 +70,11 @@ func Merge(dst interface{}, mp map[string]interface{}, opts ...Option) error {
tpart := strings.Split(tvalue, ",")
switch tname {
case "protobuf":
fname = tpart[3][5:]
for _, p := range tpart {
if idx := strings.Index(p, "name="); idx > 0 {
fname = p[idx:]
}
}
default:
fname = tpart[0]
}
@@ -231,13 +235,14 @@ func Merge(dst interface{}, mp map[string]interface{}, opts ...Option) error {
default:
err = ErrInvalidValue
}
}

if err != nil {
err = fmt.Errorf("%v key %v invalid val %v", err, fname, sval.Interface())
if err != nil {
err = fmt.Errorf("%v key %v invalid val %v", err, fname, sval.Interface())
}

}

return err
return nil
}

func mergeBool(dval reflect.Value, sval reflect.Value) error {