Skip to content
/ fm Public

fm is short for fang-mao 仿冒 and generates spies of interfaces in Go

License

Notifications You must be signed in to change notification settings

enocom/fm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fm Build Status Go Report Card GoDoc

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.

Background

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.

TODO

  • support embedded interfaces

About

fm is short for fang-mao 仿冒 and generates spies of interfaces in Go

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published