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

skip not match transformer #217

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix skip error
kooksee committed Jul 11, 2022
commit 999fbf9ead19c089ba640fd672f3b4278e91d52a
4 changes: 2 additions & 2 deletions merge.go
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ import (
"reflect"
)

var Skip = errors.New("mergo: skip custom transformer")
var ErrSkip = errors.New("mergo: skip custom transformer")

func hasMergeableFields(dst reflect.Value) (exported bool) {
for i, n := 0, dst.NumField(); i < n; i++ {
@@ -86,7 +86,7 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co
if fn := config.Transformers.Transformer(dst.Type()); fn != nil {
err = fn(dst, src)
// Allow users to judge by the type of DST and SRC, and skip the check
if err != Skip {
if err != ErrSkip {
return
}
}