Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 2d3cc15

Browse files
committed
Don't report error from bytes.Buffer WriteTo method
1 parent 0de79a2 commit 2d3cc15

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

cgi_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ func TestInspect(t *testing.T) {
307307
_, err = buf.ReadFrom(res.Body)
308308
if err == nil {
309309
str := buf.String()
310-
fmt.Printf("%s\n", str)
311310
if !strings.Contains(str, "CGI for Caddy") {
312311
err = fmt.Errorf("unexpected response for \"inspect\" request")
313312
}

inspect.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ type kvType struct {
3434

3535
func inspect(hnd cgi.Handler, w http.ResponseWriter, req *http.Request, rep httpserver.Replacer) {
3636
var buf bytes.Buffer
37-
var err error
3837

3938
printf := func(format string, args ...interface{}) {
4039
fmt.Fprintf(&buf, format, args...)
@@ -102,8 +101,5 @@ func inspect(hnd cgi.Handler, w http.ResponseWriter, req *http.Request, rep http
102101
repPrint("{.}", "{host}", "{match}", "{method}", "{root}", "{when}")
103102

104103
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
105-
_, err = buf.WriteTo(w)
106-
if err != nil {
107-
fmt.Fprintf(hnd.Stderr, "%s", err)
108-
}
104+
buf.WriteTo(w)
109105
}

0 commit comments

Comments
 (0)