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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Interfaces and Go. A bit confused.

  • 23-01-2016 5:10pm
    #1
    Registered Users, Registered Users 2 Posts: 2,236 ✭✭✭


    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, Registered Users 2 Posts: 6,289 ✭✭✭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