-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: make plugin more easier to maintain #83
Conversation
though the encode and decode file is so complex, but we can add many test cases to ensure its correctness, and we can contribute this encode module into |
some code in later I will see should we add some license for that or I will remove most of them and write by my own |
Amazing, I will start reviewing this change tomorrow, what a big change. Hahaha |
a695f47
to
4dc97fe
Compare
31598e9
to
92e7071
Compare
@@ -66,6 +68,19 @@ func newCmd() *cmd { | |||
_, _ = fmt.Fprintln(ctx.App.Writer, command.Name) | |||
} | |||
} | |||
|
|||
debugFlags := &cli.BoolFlag{ | |||
Name: "debug", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only worked when this flag before any subcommand,
related: #88
dc5a407
to
7061f28
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bytemain I think this refactoring has been very complete for plugin.
However, the solution to #26 is not complete enough, and there is too little log information. Therefore, this change is not considered to be initiated to solve #26, It is simply a refactoring of the plug-in.
In addition, we also need to add to the documentation the usage of the --debug
parameter.
Yes, I know that, this pr just add a basic logger, in order to see the debug info when I write the encoding code. |
* refactor: add lua vm struct * feat: support struct marshal * feat: add more ctx * fix: encoding tag map error * feat: add logger * feat: add debug flag * fix: fix decode in mixed struct * fix: unmarshal to interface is not work * feat: ctx use marshal * feat: unmarshal hook result * ci: update test cases * test: streamline encoding unit test * chore: remove print * test: add more testcases * chore: revert hook name enum * chore: add license * chore: update log message * refactor: add plugin module * refactor: add a vm file * chore: update logger * chore: add license * feat: support marshal nil * fix: preinstall should work * fix: lua checksum * chore: update code * refactor: unmarshal plugin info * chore: some modifications * mod: remove debug log in encoding func * mod: Optimize function calls * bugfix * mod --------- Co-authored-by: lihan <lihan@apache.org>
here I create a new module called: luai(lua interface)
we can define many thing with the lua world in this module.
the thing I first made is a transformer, which can transform golang struct to lua table(most cases, but you still can use it transform golang int to lua number)
this bring another benifit, the data structure now is defined in golang, so we even can change our plugin engine to javascript(even simpler is, just encode to json)
and I try made a new struct called
LuaVM
, which will simplify our opreations when interact with the lua world