fix: Code review round 2 — race conditions, dead code, hardcoded paths

CRITICAL fixes:
- #1 vm.go: Mutex on libModules/dynamicFuncs global slices
  RegisterLibModule/RegisterDynamicFunc now thread-safe
  RegisterLibModules copies under lock, clears, releases
- #4 shutdown.go: Signal handler goroutine leak fixed
  Uses done channel + select for clean exit on normal shutdown

HIGH fixes:
- #7-8 gobridge.go: Remove dead if/else branches (both identical)
- #13-14 main.go: Remove hardcoded /mnt/d/harbour-core paths
  Use HB_INC env var + standard /usr/local/include/harbour only
- #15 main.go: Remove unused frbModSeq variable

MEDIUM fixes:
- #22 expr.go: Remove unused parts variable in parseInterpolatedString
- #51 macro.go: Remove var _ = fmt.Sprintf import guard
- macroeval.go: Remove unused lexer import and guard

Total fixed this session: 12/53 issues resolved
Remaining: 41 (CRITICAL: 1, HIGH: 9, MEDIUM: 16, LOW: 16)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-01 10:32:09 +09:00
parent 7c61db70c3
commit d7513eeb24
7 changed files with 144 additions and 41 deletions

View File

@@ -701,7 +701,6 @@ func (p *Parser) parseInterpolatedString() ast.Expr {
strTok := p.expect(token.STRING)
src := strTok.Literal
var parts []ast.Expr
var fmtBuf string
var args []ast.Expr
@@ -742,7 +741,6 @@ func (p *Parser) parseInterpolatedString() ast.Expr {
}
// Build: fmt.Sprintf(fmtStr, arg1, arg2, ...)
_ = parts // not used in Sprintf approach
allArgs := make([]ast.Expr, 0, len(args)+1)
allArgs = append(allArgs, &ast.LiteralExpr{ValuePos: fPos, Kind: token.STRING, Value: fmtBuf})
allArgs = append(allArgs, args...)