Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Interfaces and Go. A bit confused.

Options
  • 23-01-2016 6:10pm
    #1
    Registered Users Posts: 2,228 ✭✭✭


    Hello,

    I am currently learning Go and looking at interfaces right now.

    To say the least I am a little confused. I do understand how it works generally but I'm not entirely sure how things are linked etc regarding mock and complete implementations for example.

    Example: I have an API interface. I then have a Go file with a full implementation. After that I created a Config struct. The full implementation is based on Config therefore Config implements API.

    My question is, when I am want to create a Mock what do I do? How would that look.

    Does anybody have any real life examples of this. Not just a simple Cirlce, Square etc implementing Shape :)

    Thanks in advance.


Comments

  • Registered Users Posts: 6,035 ✭✭✭Talisman


    Do you want to write your Mocks by hand? The GoMock framework has a mockgen tool to generate mock interfaces for a given source file.


Advertisement