nolint:gochecknoglobals
(w io.Writer, rd io.Reader, unzip, indentJSON bool)
| 24 | var timeZone = "local" //nolint:gochecknoglobals |
| 25 | |
| 26 | func showContentWithFlags(w io.Writer, rd io.Reader, unzip, indentJSON bool) error { |
| 27 | if unzip { |
| 28 | gz, err := gzip.NewReader(rd) |
| 29 | if err != nil { |
| 30 | return errors.Wrap(err, "unable to open gzip stream") |
| 31 | } |
| 32 | |
| 33 | rd = gz |
| 34 | } |
| 35 | |
| 36 | var buf1, buf2 bytes.Buffer |
| 37 | |
| 38 | if indentJSON { |
| 39 | if err := iocopy.JustCopy(&buf1, rd); err != nil { |
| 40 | return errors.Wrap(err, "error copying data") |
| 41 | } |
| 42 | |
| 43 | if err := json.Indent(&buf2, buf1.Bytes(), "", " "); err != nil { |
| 44 | return errors.Wrap(err, "errors indenting JSON") |
| 45 | } |
| 46 | |
| 47 | rd = io.NopCloser(&buf2) |
| 48 | } |
| 49 | |
| 50 | if err := iocopy.JustCopy(w, rd); err != nil { |
| 51 | return errors.Wrap(err, "error copying data") |
| 52 | } |
| 53 | |
| 54 | return nil |
| 55 | } |
| 56 | |
| 57 | func maybeHumanReadableBytes[I constraints.Integer](enable bool, value I) string { |
| 58 | if enable { |
no test coverage detected