Use buffered channels for os.Signal to prevent missing signals and fix sigchanyzer vet errors.
Use buffered channels for os.Signal to prevent missing signals; unbuffered channels block if no receiver is ready. Create the channel with a buffer size of 1 when passing it to signal.Notify.
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt)
The sigchanyzer vet check detects this pattern and suggests adding the buffer.
An unbuffered channel blocks the sender until a receiver is ready, which can cause your program to miss critical system signals like Ctrl+C. A buffered channel holds the signal in a small queue, ensuring the program catches it even if it's busy doing other work. Think of it as a mailbox (buffered) versus a phone call (unbuffered); if you're not home, the letter waits in the box, but the call goes to voicemail or is missed.