diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 39e826e..898d7be 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -11,7 +11,7 @@ jobs: - run: sudo apt-get install libusb-1.0-0-dev - run: go install golang.org/x/tools/cmd/cover@latest - run: go install golang.org/x/lint/golint@latest - - run: $HOME/go/bin/golint ./... + - run: $HOME/go/bin/golint -set_exit_status ./... - run: sh ./.github/test-coverage.sh - uses: shogo82148/actions-goveralls@v1 with: diff --git a/libusb.go b/libusb.go index ee924e7..4e7ea1d 100644 --- a/libusb.go +++ b/libusb.go @@ -209,7 +209,7 @@ func (libusbImpl) getDevices(ctx *libusbContext) ([]*libusbDevice, error) { for _, d := range devs { ret = append(ret, (*libusbDevice)(d)) } - // devices must be dereferenced by the caller to prevent memoryleaks + // devices must be dereferenced by the caller to prevent memory leaks. C.libusb_free_device_list(list, 0) return ret, nil } diff --git a/transfer_stream.go b/transfer_stream.go index a32662c..b5705c4 100644 --- a/transfer_stream.go +++ b/transfer_stream.go @@ -269,14 +269,15 @@ func (w *WriteStream) Close() error { return w.CloseContext(context.Background()) } -// Close signals end of data to write. Close blocks until all transfers -// that were sent are finished. The error returned by Close is the first -// error encountered during writing the entire stream (if any). -// Close returning nil indicates all transfers completed successfully. -// After Close, the total number of bytes successfully written can be +// CloseContext signals end of data to write. CloseContext blocks until all +// transfers that were sent are finished or until the context is canceled. The +// error returned by CloseContext is the first error encountered during writing +// the entire stream (if any). +// CloseContext returning nil indicates all transfers completed successfully. +// After CloseContext, the total number of bytes successfully written can be // retrieved using Written(). -// Close may not be called concurrently with Write, Close or Written. -// CloseContext +// CloseContext may not be called concurrently with Write, WriteContext, Close, +// CloseContext or Written. func (w *WriteStream) CloseContext(ctx context.Context) error { if w.s.transfers == nil { return io.ErrClosedPipe diff --git a/usb.go b/usb.go index 77db23c..a6b0714 100644 --- a/usb.go +++ b/usb.go @@ -246,7 +246,7 @@ func (c *Context) checkOpenDevs() error { c.mu.Lock() defer c.mu.Unlock() if l := len(c.devices); l > 0 { - return fmt.Errorf("Context.Close called while %d Devices are still open, Close may be called only after all previously opened devices were successfuly closed.", l) + return fmt.Errorf("Context.Close called while %d Devices are still open, Close may be called only after all previously opened devices were successfuly closed", l) } return nil }