Interfacer
English | ไธญๆๆๆกฃ
Implement new methods in the interface everywhere
ๅฟซ้็ป็ฐๆๆฅๅฃๆทปๅ ๆฐๆนๆณ๏ผ็ป็ธๅ
ณ็ปๆ่ชๅจ็ๆ้ป่ฎคๅฎ็ฐ
๐ Effect
When you add a method to an interface, the corresponding implementation cannot be found after adding the method.
Because of the addition of an additional method, the previous implementations are all invalid.
In general, adding a method to an interface is cumbersome and time-consuming.
๐ Getting started
๐ Install
There are three ways to install it, including:
-
Binary file
you can get the latest version by the link: interfacer
-
Install by go install
Tips: If you use the windows, you can download the source code and build the tool.
go install github.com/SimFG/interfacer
-
Source build
a. clone the repository
git clone github.com/SimFG/interfacer
b. build
go build interfacer.go interfacer_handle.go
๐ฌ Detailed usage
link: USAGE
๐ชง Tips
Some problems may be encountered during use, as the tool is currently under development. You can give me an issue If you encounter any problems using.
๐งญ Roadmap
- Dealing with generated code out of order of comments
- for interface โ
- for struct method
- Exclude dirs or files
- accurate โ
- fuzzy matching
- Debug mode, print the detail info โ
- It will be ignored if the new method has existed โ
- Scan many third modules' files and then get all the implements of the interface, like the protobuf interface โ
- Check the input params โ
- Customer the configuration yaml file path โ
- Update the Chinese README file โ
- Beautify the README file โ
- Dynamic display of program running time โ
- Show scan progress โ
- Using the function name and receiver type to check whether the method has existed โ
- Configure whether to add a new line when generating the new method for the interface โ
- Support the use of
go generate
annotations in the program โ
- Handle the no name params in the method, like
foo(bool)
โ
- Configure whether to add the new method if the inner struct or interface has contained the new method
- Individually add a method for different structs that implements different interfaces of the third modules
- Write the method content easily by the way similar to writing interface
- Contributing doc
- Handle the more params that are the same type, like
foo(a, b bool)
- Idea plugin
- Customer the insert position
- Generate more complex default method implement by the template
- Support to generate more methods
- More readable codes
- Handle the un-import interface or struct param when adding the new method
- Handle some special struct or interface
- More useful tool of reading and writing
go
file
- Ast example doc