( buf *redact.StringBuilder, valDirs []Direction, b []byte, sep redact.SafeString, )
| 2188 | } |
| 2189 | |
| 2190 | func prettyPrintValueImpl( |
| 2191 | buf *redact.StringBuilder, valDirs []Direction, b []byte, sep redact.SafeString, |
| 2192 | ) bool { |
| 2193 | allDecoded := true |
| 2194 | for len(b) > 0 { |
| 2195 | // If there are more values than encoding directions specified, |
| 2196 | // valDir will contain the 0 value of Direction. |
| 2197 | // prettyPrintFirstValue will then use the default encoding |
| 2198 | // direction per each value type. |
| 2199 | var valDir Direction |
| 2200 | if len(valDirs) > 0 { |
| 2201 | valDir = valDirs[0] |
| 2202 | valDirs = valDirs[1:] |
| 2203 | } |
| 2204 | |
| 2205 | bb, s, err := prettyPrintFirstValue(valDir, b) |
| 2206 | if err != nil { |
| 2207 | // If we fail to decode, mark as unknown and attempt |
| 2208 | // to continue - it's possible we can still decode the |
| 2209 | // remainder of the key bytes. |
| 2210 | allDecoded = false |
| 2211 | // Mark the separator as safe. |
| 2212 | buf.Print(sep) |
| 2213 | buf.SafeString("???") |
| 2214 | } else { |
| 2215 | buf.Print(sep) |
| 2216 | buf.Print(redact.Safe(s)) |
| 2217 | } |
| 2218 | b = bb |
| 2219 | } |
| 2220 | return allDecoded |
| 2221 | } |
| 2222 | |
| 2223 | // prettyPrintFirstValue returns a string representation of the first decodable |
| 2224 | // value in the provided byte slice, along with the remaining byte slice |
no test coverage detected
searching dependent graphs…