Skip to content

Commit

Permalink
textproto: fix errcheck lint errors from imported files
Browse files Browse the repository at this point in the history
  • Loading branch information
jhillyerd committed Mar 13, 2023
1 parent a968184 commit e51c34d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions internal/textproto/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (r *Reader) skipSpace() int {
break
}
if c != ' ' && c != '\t' {
r.R.UnreadByte()
_ = r.R.UnreadByte()
break
}
n++
Expand Down Expand Up @@ -373,7 +373,7 @@ func (d *dotReader) Read(b []byte) (n int, err error) {
}
// Not part of .\r\n.
// Consume leading dot and emit saved \r.
br.UnreadByte()
_ = br.UnreadByte()
c = '\r'
d.state = stateData

Expand All @@ -383,7 +383,7 @@ func (d *dotReader) Read(b []byte) (n int, err error) {
break
}
// Not part of \r\n. Emit saved \r
br.UnreadByte()
_ = br.UnreadByte()
c = '\r'
d.state = stateData

Expand Down Expand Up @@ -418,7 +418,7 @@ func (r *Reader) closeDot() {
for r.dot != nil {
// When Read reaches EOF or an error,
// it will set r.dot == nil.
r.dot.Read(buf)
_, _ = r.dot.Read(buf)
}
}

Expand Down Expand Up @@ -589,7 +589,7 @@ var nl = []byte("\n")
// that will be in this header. If it gets confused, it returns 0.
func (r *Reader) upcomingHeaderNewlines() (n int) {
// Try to determine the 'hint' size.
r.R.Peek(1) // force a buffer load if empty
_, _ = r.R.Peek(1) // force a buffer load if empty
s := r.R.Buffered()
if s == 0 {
return
Expand Down
4 changes: 2 additions & 2 deletions internal/textproto/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ func TestIssue46363(t *testing.T) {
r, w := net.Pipe()
go func() {
// ReadMIMEHeader calls canonicalMIMEHeaderKey, which reads from commonHeader
NewConn(r).ReadMIMEHeader()
_, _ = NewConn(r).ReadMIMEHeader()
}()
w.Write([]byte("A: 1\r\nB: 2\r\nC: 3\r\n\r\n"))
_, _ = w.Write([]byte("A: 1\r\nB: 2\r\nC: 3\r\n\r\n"))

// CanonicalMIMEHeaderKey calls commonHeaderOnce.Do(initCommonHeader) which initializes commonHeader
CanonicalMIMEHeaderKey("a")
Expand Down
6 changes: 3 additions & 3 deletions internal/textproto/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var dotcrnl = []byte{'.', '\r', '\n'}
func (w *Writer) PrintfLine(format string, args ...any) error {
w.closeDot()
fmt.Fprintf(w.W, format, args...)
w.W.Write(crnl)
_, _ = w.W.Write(crnl)
return w.W.Flush()
}

Expand Down Expand Up @@ -73,7 +73,7 @@ func (d *dotWriter) Write(b []byte) (n int, err error) {
d.state = wstateData
if c == '.' {
// escape leading dot
bw.WriteByte('.')
_ = bw.WriteByte('.')
}
fallthrough

Expand All @@ -82,7 +82,7 @@ func (d *dotWriter) Write(b []byte) (n int, err error) {
d.state = wstateCR
}
if c == '\n' {
bw.WriteByte('\r')
_ = bw.WriteByte('\r')
d.state = wstateBeginLine
}

Expand Down

0 comments on commit e51c34d

Please sign in to comment.