golang / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
9.26k stars 608 forks source link

gob: name not registered for interface #138

Closed kamilsk closed 6 years ago

kamilsk commented 6 years ago

Hi! I have failed build with gomock on the master branch.

2017/12/18 11:18:46 Loading input failed: gob: name not registered for interface: "github.com/kamilsk/form-api/vendor/github.com/golang/mock/mockgen/model.PredeclaredType"

For that reason, I switched back gomock to release v1.0.0

    if ! command -v mockgen > /dev/null; then \
        go get -d github.com/golang/mock/mockgen; \
        cd $(GOPATH)/src/github.com/golang/mock/mockgen && git checkout v1.0.0; \
        go install github.com/golang/mock/mockgen; \
    fi

and the problem is gone.

Possible cause can be located here https://github.com/golang/mock/compare/v1.0.0...master#diff-0f304850dfe306e76016f4bc2d70d23e, https://github.com/golang/mock/commit/62fcac7daf35529870a199ae024e158d665cb392#diff-0f304850dfe306e76016f4bc2d70d23e

Could you explain what I did wrong? I didn't have time to investigate the issue yet, and you can help me to reduce this time. Thanks!

kamilsk commented 6 years ago

I changed constraint for dep

[[constraint]]
  name = "github.com/golang/mock"
  branch = "master"

and restored tool installation

    if ! command -v mockgen > /dev/null; then \
        go get github.com/golang/mock/mockgen; \
    fi