Skip to content

Fix shadowing field runnnig#227

Merged
Leeaandrob merged 1 commit intosipeed:mainfrom
mattn:fix-shadowing-running
Feb 17, 2026
Merged

Fix shadowing field runnnig#227
Leeaandrob merged 1 commit intosipeed:mainfrom
mattn:fix-shadowing-running

Conversation

@mattn
Copy link
Contributor

@mattn mattn commented Feb 15, 2026

running field is shadowing in BaseChannel.running. So running field always be false.

@Leeaandrob
Copy link
Collaborator

@Zepan Trivial but correct fix by @mattn — removes a shadowed field. Clean code hygiene.

Recommendation: Merge. 2-line fix, zero risk.

Copy link
Collaborator

@Leeaandrob Leeaandrob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #227 Deep Review — @mattn

Clean, correct fix. The running bool field in MaixCamChannel shadowed the embedded BaseChannel.running, causing c.running (direct field access at line 73) to always read false while c.setRunning(true) set the base field.


Verification

  • Checked out branch locally: fix-shadowing-running
  • go vet ./pkg/channels/... — clean
  • go test ./pkg/channels/... — all 15 tests passing
  • Audited all 12 channel struct definitions — no other channel has this shadowing issue
  • Confirmed c.running at maixcam.go:73 now correctly resolves to BaseChannel.running through Go embedding promotion

Impact Analysis

Before fix:

  • c.setRunning(true) → sets BaseChannel.running = true
  • c.IsRunning() → reads BaseChannel.runningtrue (correct)
  • c.running (line 73) → reads MaixCamChannel.runningalways false (shadowed!)

Effect: Connection accept errors were silently swallowed — the error log at line 73-77 never fired because the shadowed field was always false.

After fix: c.running correctly resolves to BaseChannel.running — error logging works.


Summary of Findings

LOW (Optional)

  • L1: c.running at line 73 is the only direct field access across all 12 channels — all others use c.IsRunning(). Consider using c.IsRunning() for consistency (minor, not blocking).

POSITIVE

  1. Correctly identifies and fixes Go struct embedding shadowing bug
  2. Minimal 2-line change with zero risk of regression
  3. No other channels are affected — confirmed by codebase audit

Verdict: APPROVE

Clean fix, zero risk. Ready to merge.

@Leeaandrob Leeaandrob merged commit 4fde017 into sipeed:main Feb 17, 2026
SebastianBoehler pushed a commit to SebastianBoehler/picoclaw that referenced this pull request Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants