(valDirs []Direction, b []byte, sep string)
| 1449 | } |
| 1450 | |
| 1451 | func prettyPrintValueImpl(valDirs []Direction, b []byte, sep string) (string, bool) { |
| 1452 | allDecoded := true |
| 1453 | var buf strings.Builder |
| 1454 | for len(b) > 0 { |
| 1455 | // If there are more values than encoding directions specified, |
| 1456 | // valDir will contain the 0 value of Direction. |
| 1457 | // prettyPrintFirstValue will then use the default encoding |
| 1458 | // direction per each value type. |
| 1459 | var valDir Direction |
| 1460 | if len(valDirs) > 0 { |
| 1461 | valDir = valDirs[0] |
| 1462 | valDirs = valDirs[1:] |
| 1463 | } |
| 1464 | |
| 1465 | bb, s, err := prettyPrintFirstValue(valDir, b) |
| 1466 | if err != nil { |
| 1467 | allDecoded = false |
| 1468 | buf.WriteString(sep) |
| 1469 | buf.WriteByte('?') |
| 1470 | buf.WriteByte('?') |
| 1471 | buf.WriteByte('?') |
| 1472 | } else { |
| 1473 | buf.WriteString(sep) |
| 1474 | buf.WriteString(s) |
| 1475 | } |
| 1476 | b = bb |
| 1477 | } |
| 1478 | return buf.String(), allDecoded |
| 1479 | } |
| 1480 | |
| 1481 | // prettyPrintFirstValue returns a string representation of the first decodable |
| 1482 | // value in the provided byte slice, along with the remaining byte slice |
no test coverage detected
searching dependent graphs…