diff --git a/.gitignore b/.gitignore index adf8f72..a53e686 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ # Go workspace file go.work +# Test directories +routes/ +static/ \ No newline at end of file diff --git a/core/workers/job.go b/core/workers/job.go index b5db4fb..b268508 100644 --- a/core/workers/job.go +++ b/core/workers/job.go @@ -2,13 +2,13 @@ package workers // JobResult represents the result of a Lua script execution type JobResult struct { - Value interface{} // Return value from Lua - Error error // Error if any + Value any // Return value from Lua + Error error // Error if any } // job represents a Lua script execution request type job struct { - Bytecode []byte // Compiled LuaJIT bytecode - Params map[string]interface{} // Parameters to pass to the script - Result chan<- JobResult // Channel to send result back + Bytecode []byte // Compiled LuaJIT bytecode + Params map[string]any // Parameters to pass to the script + Result chan<- JobResult // Channel to send result back } diff --git a/core/workers/pool.go b/core/workers/pool.go index 1c5c1fb..0d92159 100644 --- a/core/workers/pool.go +++ b/core/workers/pool.go @@ -42,7 +42,7 @@ func NewPool(numWorkers int) (*Pool, error) { } // SubmitWithContext sends a job to the worker pool with context -func (p *Pool) SubmitWithContext(ctx context.Context, bytecode []byte, params map[string]interface{}) (interface{}, error) { +func (p *Pool) SubmitWithContext(ctx context.Context, bytecode []byte, params map[string]any) (any, error) { if !p.isRunning.Load() { return nil, ErrPoolClosed } diff --git a/core/workers/worker.go b/core/workers/worker.go index c481cbd..e02259c 100644 --- a/core/workers/worker.go +++ b/core/workers/worker.go @@ -103,7 +103,7 @@ func (w *worker) resetState() { } // setParams sets job parameters as a global 'params' table -func (w *worker) setParams(params map[string]interface{}) error { +func (w *worker) setParams(params map[string]any) error { // Create new table for params w.state.NewTable() @@ -157,6 +157,6 @@ func (w *worker) executeJob(j job) JobResult { } // Submit sends a job to the worker pool -func (p *Pool) Submit(bytecode []byte, params map[string]interface{}) (interface{}, error) { +func (p *Pool) Submit(bytecode []byte, params map[string]any) (any, error) { return p.SubmitWithContext(context.Background(), bytecode, params) }