Feedback about the go-mock script that create mocks for all automatically and recursively detected Go interfaces

29 views
Skip to first unread message

Tymoteusz Blazejczyk

unread,
May 23, 2020, 6:38:31 AM5/23/20
to golang-nuts
Hi Everyone!

Recently I have working on a project that allow to work on Go projects out-of-box using a Docker image.
It contains preinstalled tools for developing, mocking, formatting, linting, building, testing and documenting Go projects.

For mocking Go interfaces, I'm using the standard and classic mockgen tool in reflect mode. One of annoying thing about that tool is command line invocations.
I have scripted that to automatically and recursively detect all Go interfaces. It excludes _test.go files, mocks directories and the package main.
Go module detection is based on the go env GOMOD command invocation. All mocks are generated under the mocks directory for given Go package.

For me it works well. But I may have miss something. And because of that, I want to ask you for a small feedback. In advance, I appreciate it for any comments :)

The go-mock script that covers this topic: https://gitlab.com/tymonx/docker-go/-/blob/master/scripts/go-mock


I also hope, that it may be useful for someone ;)

Best regards,
Tymoteusz Blazejczyk
FPGA and Embedded Systems Design Engineer

NIP PL 604 009 61 33 | REGON 385 865 948
image image image image image image image image


Reply all
Reply to author
Forward
0 new messages