Tagged articles
5 articles
Page 1 of 1
Go Programming World
Go Programming World
May 16, 2024 · Backend Development

Using Monkey Patching with gomonkey for Unit Testing in Go

This article demonstrates how to apply Monkey Patching in Go using the gomonkey library to unit‑test a simple HTTP service, covering code examples, dependency analysis, patch creation, test execution parameters, and practical considerations such as inlining and concurrency limitations.

BackendGoHTTP
0 likes · 12 min read
Using Monkey Patching with gomonkey for Unit Testing in Go
Ops Development & AI Practice
Ops Development & AI Practice
Apr 6, 2024 · Backend Development

How to Simulate Monkey Patching in Go Using Interfaces and Reflection

The article explains why Go does not support traditional monkey patching, then demonstrates two practical approaches—using interfaces with wrapper types and employing reflection—to extend a SimpleLogger with log levels without modifying its source, while discussing trade‑offs such as readability and performance.

Design PatternsGoInterface
0 likes · 6 min read
How to Simulate Monkey Patching in Go Using Interfaces and Reflection
MaGe Linux Operations
MaGe Linux Operations
Aug 21, 2019 · Fundamentals

Understanding Python’s Duck Typing and Monkey Patching with Real Code

This article explains Python’s dynamic features—duck typing and monkey patching—through clear analogies and practical code examples, demonstrating how objects are identified by behavior rather than type and how classes or modules can be modified at runtime without altering original source code.

Monkey PatchingPythonduck-typing
0 likes · 5 min read
Understanding Python’s Duck Typing and Monkey Patching with Real Code