Coder Social home page Coder Social logo

Comments (10)

darccio avatar darccio commented on May 20, 2024

Yes, sure. I'll check it this weekend.

from mergo.

iampeter avatar iampeter commented on May 20, 2024

Thanks @imdario

from mergo.

iampeter avatar iampeter commented on May 20, 2024

@imdario any luck with this? thanks

from mergo.

darccio avatar darccio commented on May 20, 2024

No, sorry, I was kinda sick and I didn't have the energy to look at this. I will try this week.

from mergo.

iampeter avatar iampeter commented on May 20, 2024

ok thanks @imdario

from mergo.

iampeter avatar iampeter commented on May 20, 2024

I just tested with just *time.Time (no new type) and it seems to 'go deeper' anyway - does not overwrite.

from mergo.

iampeter avatar iampeter commented on May 20, 2024

@imdario, doesn't this:

    case reflect.Ptr:
        fallthrough
    case reflect.Interface:
        if src.IsNil() {
            break
        } else if dst.IsNil() {
            if dst.CanSet() && (overwrite || isEmptyValue(dst)) {
                dst.Set(src)
            }
        } else if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, overwrite); err != nil {
            return
        }

mean that if the destination pointer exists, it will try to deep-merge anyway, instead of overwriting the whole struct the pointer points to?

from mergo.

darccio avatar darccio commented on May 20, 2024

if the destination pointer exists, it will try to deep-merge anyway, instead of overwriting the whole struct the pointer points to?

Yes, you are right. "overwrite" should be used with dst.IsNil(). If dst is not nil, as in your case, it won't check if it must overwrite it anyway. Good catch! I modify it, test and push it to master.

from mergo.

darccio avatar darccio commented on May 20, 2024

A little test and... Ta-da! That little sneaky bug has been fixed. Please, update your local repository and check if it works for you too.

Sorry for not being able to work on this before.

from mergo.

iampeter avatar iampeter commented on May 20, 2024

Great, thanks @imdario !

from mergo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.