From 58023afab96d9598e6c92231ace3726e09557fc7 Mon Sep 17 00:00:00 2001 From: Shubham Date: Sat, 4 Jun 2022 19:55:03 +0530 Subject: [PATCH] Ignore zap logger sync error Prior to this commit, this is how all `tkn chains` output starts like: ``` $ tkn chain payload build-push-run-output-image-p229w sync /dev/stderr: invalid argument ... ... ``` This commit gets rid of the `sync /dev/stderr: invalid argument` error by ignoring it, which is safe: see https://github.com/uber-go/zap/issues/328 --- pkg/chain/chain.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/chain/chain.go b/pkg/chain/chain.go index 2a42a08d0..4d919f994 100644 --- a/pkg/chain/chain.go +++ b/pkg/chain/chain.go @@ -43,9 +43,8 @@ func GetTaskRunBackends(cs *cli.Clients, namespace string, tr *v1beta1.TaskRun) } // flushes buffer, if any defer func() { - if err := logger.Sync(); err != nil { - fmt.Println(err) - } + // intentionally ignoring error here, see https://github.com/uber-go/zap/issues/328 + _ = logger.Sync() }() sugaredLogger := logger.Sugar()