Skip to content

fix go vet findings: in-place job construction, buffered signal channel - #115

Merged
leontappe merged 2 commits into
masterfrom
fix/go-vet-issues
Jul 24, 2026
Merged

fix go vet findings: in-place job construction, buffered signal channel#115
leontappe merged 2 commits into
masterfrom
fix/go-vet-issues

Conversation

@leontappe

Copy link
Copy Markdown
Contributor

Fixes #112.

go vet ./... failed on master with three findings; this makes the tree vet-clean so vet can be added to CI (#110):

  • NewCommonJob copied baseJob by value and NewLazyJob copied CommonJob by value — both contain sync.WaitGroup (and since Treat lazy cool-down stops as expected instead of errors #108 an atomic.Bool). Construction now initializes the embedded baseJob in place via a new (*baseJob).init method, 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.)
  • The os.Signal channel in cmd/up.go was unbuffered, which signal.Notify documents as lossy; it is now buffered with capacity 1.

Also drops a redundant duplicate phase.Set(JobPhaseReasonAwaitingReadiness) in NewLazyJob (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

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>
Base automatically changed from feat/lazy-cooldown-expected-stop to master July 17, 2026 13:39
@leontappe
leontappe requested a review from Copilot July 23, 2026 11:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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/LazyJob construction to initialize baseJob in place via a new (*baseJob).init helper, avoiding copying lock-bearing structs.
  • Updated tests to use the new in-place initialization path.
  • Buffered the os.Signal channel used with signal.Notify to 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.

Comment thread pkg/proc/types.go Outdated
leontappe added a commit that referenced this pull request Jul 24, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
leontappe added a commit that referenced this pull request Jul 24, 2026
The merge of fix/log-pipe-close-race (#119) with the fix/go-vet-issues
stack (#115) left a semantic conflict: the test still called the removed
newBaseJob constructor.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
leontappe merged commit c048e9c into master Jul 24, 2026
1 check passed
@leontappe
leontappe deleted the fix/go-vet-issues branch July 24, 2026 12:47
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>
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.

go vet fails on master (copied locks, unbuffered signal channel)

2 participants