Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
nijave
· 1y ago · 0 comments
Maybe I'm missing something obvious but that seemed to be the only option for injecting stub implementations in integration tests.
Comments
[–]
roncesvalles
1y ago
I prefer the testing libraries that do monkey-patching and consider mock implementations of interfaces to be an antipattern in Go, especially if it's the only reason for putting an interface between the calling code and a type.
[–]
mikeschinkel
1y ago
Interfaces are one way to inject stubs, and a good way, but not the only way. You can also use function values as callbacks.