From 0ed90ec3bb2de99ebfa4e8db59dce42db16c352f Mon Sep 17 00:00:00 2001 From: Shulhan Date: Wed, 6 Jan 2021 01:28:23 +0700 Subject: http: ignore errors in the example codes --- lib/http/endpoint_example_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/http/endpoint_example_test.go') diff --git a/lib/http/endpoint_example_test.go b/lib/http/endpoint_example_test.go index b605a931..441f4043 100644 --- a/lib/http/endpoint_example_test.go +++ b/lib/http/endpoint_example_test.go @@ -29,11 +29,11 @@ func ExampleEndpoint_errorHandler() { codeMsg := strings.Split(err.Error(), ":") if len(codeMsg) != 2 { res.WriteHeader(http.StatusInternalServerError) - res.Write([]byte(err.Error())) + _, _ = res.Write([]byte(err.Error())) } else { code, _ := strconv.Atoi(codeMsg[0]) res.WriteHeader(code) - res.Write([]byte(codeMsg[1])) + _, _ = res.Write([]byte(codeMsg[1])) } }, } @@ -42,7 +42,9 @@ func ExampleEndpoint_errorHandler() { go func() { _ = server.Start() }() - defer server.Stop(1 * time.Second) + defer func() { + _ = server.Stop(1 * time.Second) + }() time.Sleep(1 * time.Second) client := NewClient("http://"+serverOpts.Address, nil, false) -- cgit v1.3