fix go vet findings: in-place job construction, buffered signal channel - #115
Merged
Conversation
NewCommonJob and NewLazyJob copied baseJob/CommonJob by value even though baseJob contains sync.WaitGroup and atomic.Bool fields; construction now initializes the embedded baseJob in place via (*baseJob).init. The os.Signal channel handed to signal.Notify in cmd/up.go is now buffered so a signal arriving before the fan-out goroutine is scheduled is not lost. Fixes #112. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR makes the codebase go vet ./... clean by removing value-copy construction of lock-bearing job structs (containing sync.WaitGroup / atomic.Bool) and by addressing a signal.Notify usage issue in the CLI.
Changes:
- Reworked
CommonJob/LazyJobconstruction to initializebaseJobin place via a new(*baseJob).inithelper, avoiding copying lock-bearing structs. - Updated tests to use the new in-place initialization path.
- Buffered the
os.Signalchannel used withsignal.Notifyto avoid lossy signal delivery.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/proc/types.go | Adds in-place baseJob initialization and updates NewCommonJob/NewLazyJob to avoid copying lock-bearing structs. |
| pkg/proc/basejob_test.go | Updates tests to build baseJob via the new init method. |
| cmd/up.go | Buffers the signal channel passed to signal.Notify. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
leontappe
added a commit
that referenced
this pull request
Jul 24, 2026
init returned early when stdout was unset, so a job configured with only stderr never had its stderr file created at init time (carried over from newBaseJob). CreateAndOpenStdFile no-ops for unset targets, so call it unconditionally. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
leontappe
added a commit
that referenced
this pull request
Jul 24, 2026
Adapts the lingering-children tests to the in-place baseJob init from #115, which replaced the newBaseJob constructor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #112.
go vet ./...failed on master with three findings; this makes the tree vet-clean so vet can be added to CI (#110):NewCommonJobcopiedbaseJobby value andNewLazyJobcopiedCommonJobby value — both containsync.WaitGroup(and since Treat lazy cool-down stops as expected instead of errors #108 anatomic.Bool). Construction now initializes the embeddedbaseJobin place via a new(*baseJob).initmethod, so no lock-bearing struct is ever copied. (The copies happened before any goroutine used the structs, so they were benign at runtime — this is about keeping vet green so it can catch real mistakes.)os.Signalchannel incmd/up.gowas unbuffered, whichsignal.Notifydocuments as lossy; it is now buffered with capacity 1.Also drops a redundant duplicate
phase.Set(JobPhaseReasonAwaitingReadiness)inNewLazyJob(already done during base-job init).Stacked on #108 (
feat/lazy-cooldown-expected-stop) to avoid conflicts with the open reaper/lazy-job stack; GitHub will retarget to master as the stack merges.🤖 Generated with Claude Code