style: format code and modernize loop syntax
- Align struct fields and constants in gjson/config.go - Add missing newline at EOF in gjson/decode.go - Remove trailing blank line in gjson/encode.go - Remove extra blank line in internal/lua/coroutine.go - Use modern for range syntax in internal/lua/pool.go Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
8643a0aff9
commit
c37364b309
@ -267,4 +267,3 @@ func formatNumber(n float64, precision int) string {
|
|||||||
// Use 'g' format for floating point
|
// Use 'g' format for floating point
|
||||||
return strconv.FormatFloat(n, 'g', precision, 64)
|
return strconv.FormatFloat(n, 'g', precision, 64)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -368,7 +368,6 @@ func (c *LuaCoroutine) executeProto(proto *glua.FunctionProto) error {
|
|||||||
fn := c.Co.NewFunctionFromProto(proto)
|
fn := c.Co.NewFunctionFromProto(proto)
|
||||||
c.Co.Push(fn)
|
c.Co.Push(fn)
|
||||||
err := c.Co.PCall(0, 0, nil)
|
err := c.Co.PCall(0, 0, nil)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
atomic.AddUint64(&c.Engine.stats.ScriptsErrors, 1)
|
atomic.AddUint64(&c.Engine.stats.ScriptsErrors, 1)
|
||||||
return fmt.Errorf("lua execution error: %w", err)
|
return fmt.Errorf("lua execution error: %w", err)
|
||||||
|
|||||||
@ -50,7 +50,7 @@ func NewLStatePool(factory func() *glua.LState, initialSize, maxSize int) *LStat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 预热:预先创建 initialSize 个 LState
|
// 预热:预先创建 initialSize 个 LState
|
||||||
for i := 0; i < initialSize; i++ {
|
for range initialSize {
|
||||||
L := p.factory()
|
L := p.factory()
|
||||||
p.pool = append(p.pool, L)
|
p.pool = append(p.pool, L)
|
||||||
p.current++
|
p.current++
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user