I'm writing unit tests for a function that I developed in golang. Here is the code snippet:
func myFunc () {
//there is some code
err := json.Unmarshal (a, &b)
if err != nil {
//handle error
}
//there is some more code
err := json.Unmarshal (c, &d)
if err != nil {
//handle error
}
}
Now I want to mock first unmarshal to return success and second unmarshal to return failure. In python, I see one similar post: Python mock multiple return values
But I cannot find one for golang. Can anyone please help me on this.