From 167d1dedbf43004d75b6c6b7bab2de2c99dbb687 Mon Sep 17 00:00:00 2001 From: Anthony Moutte Date: Wed, 21 Oct 2020 14:21:43 +0200 Subject: [PATCH] try fixup example --- middleware/correlation_id_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/middleware/correlation_id_test.go b/middleware/correlation_id_test.go index 781b88c..ec7c6af 100644 --- a/middleware/correlation_id_test.go +++ b/middleware/correlation_id_test.go @@ -64,7 +64,11 @@ func ExampleCorrelationId() { }() resp, err := http.Get("http://localhost" + port) - fmt.Printf("%s: %v %v\n", "my-personal-header-name", resp.Header.Get("my-personal-header-name"), err) + if resp != nil { + fmt.Println(err) + } else { + fmt.Printf("%s: %v\n", "my-personal-header-name", resp.Header.Get("my-personal-header-name")) + } - //Output: my-personal-header-name: my-fixed-request-id + //Output: my-personal-header-name: my-fixed-request-id }