fm is short for fang-mao 仿冒 and generates spies of interfaces in Go
The letters fm
are short for the Chinese word fangmao 仿冒, which literally means “to imitate and obscure”, or “counterfeit.” It is also a tool written in Go for generating spy implementations of interfaces.
Note: the use of the word “spy” is deliberate. See here for more.
Writing a spy generator is the “Hello, World!” of AST parsing and generating in Go. There are many full featured libraries that do the same thing and better. For example, see Counterfeiter, Hel, or GoMock. The code here represents my own minimalist approach to the problem of generating test doubles. Generally, I prefer writing spies by hand, which makes for simpler tests and one less dependency to manage. Less is more.