Repository navigation
go-serial v0.1.7
Date: 2026-10-28
Previous release: v0.1.6
Summary
Patch release: POSIX Read now honours the io.Reader contract when a
read fails or the device goes away. Found while building go-canbus's slcan
transport, which drives USB CAN adapters through this package.
Changes
Fixes
Readnever returns a negative count. A failingread(2)used to
returnn == -1with the error; callers doingbuf[:n]panicked. It now
returnsn == 0.Readreportsio.EOFafter a hangup. Whenselect(2)reports the
device readable butread(2)returns no data, the other end hung up (an
unplugged USB adapter, a closed pseudo-terminal).Readused to return
(0, nil)forever; it now returnsio.EOF.
Tests
TestReadAfterHangupcloses the pseudo-terminal's other end and checks
thatReadends with an error andn == 0. It fails without the fix.
Unchanged
- Windows behaviour, the API and timeouts.