mardi 13 août 2019

Go : How to compare two values which are structs but returned as interface?

I have a function A which creates a struct from 3 different values a, b, c.

func A() interface{} {
    s := new(struct{
        a, b, c int
    })
    //fill the values in s
    return s
}

Now when I am testing this function, how will I compare the returned interface with some expected result?

I cannot move the struct definition global

Aucun commentaire:

Enregistrer un commentaire