Skip to content

Mock input arguments not matching after v1.11.0 #1785

@knightpp

Description

@knightpp

Description

After v1.11.0 some tests in my project started to fail. It can be fixed by downgrading to v1.10.0. The test setups expectations ignoring the first argument by passing mock.Anything and passing pointer to a protobuf struct as the second argument.

Step To Reproduce

Not yet

Expected behavior

It works with v1.10.0, so should still work after update. Alternatively, I'd expect Diff: No differences. to show something if the call didn't match.

Actual behavior


  [FAILED]

  mock: Unexpected Method Call
  -----------------------------

  GetTopN(*context.cancelCtx,*some.ProtoStruct)
                0: &context.cancelCtx{...}
                1: &some.ProtoStruct{state:impl.MessageState{NoUnkeyedLiterals:pragma.NoUnkeyedLiterals{}, DoNotCompare:pragma.DoNotCompare{}, DoNotCopy:pragma.DoNotCopy{}, atomicMessageInfo:(*impl.MessageInfo)(0xc0003757d8)}, unknownFields:[]uint8(nil), sizeCache:0, ...}

  The closest call I have is:

  GetTopN(string,*some.ProtoStruct)
                0: "mock.Anything"
                1: &some.ProtoStruct{state:impl.MessageState{NoUnkeyedLiterals:pragma.NoUnkeyedLiterals{}, DoNotCompare:pragma.DoNotCompare{}, DoNotCopy:pragma.DoNotCopy{}, atomicMessageInfo:(*impl.MessageInfo)(0xc0003757d8)}, unknownFields:[]uint8(nil), sizeCache:0, ...}


  Diff: No differences.
  at: [/workspace/path/mocks.go:6589 ... /usr/local/go/src/runtime/asm_amd64.s:1693]

  In [It] at: /workspace/vendor/github.com/stretchr/testify/mock/mock.go:361 @ 08/26/25 15:32:27.778

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions