(b []byte)
| 430 | } |
| 431 | |
| 432 | func (w *textWriter) writeUnknownFields(b []byte) { |
| 433 | if !w.compact { |
| 434 | fmt.Fprintf(w, "/* %d unknown bytes */\n", len(b)) |
| 435 | } |
| 436 | |
| 437 | for len(b) > 0 { |
| 438 | num, wtyp, n := protowire.ConsumeTag(b) |
| 439 | if n < 0 { |
| 440 | return |
| 441 | } |
| 442 | b = b[n:] |
| 443 | |
| 444 | if wtyp == protowire.EndGroupType { |
| 445 | w.indent-- |
| 446 | w.Write(endBraceNewline) |
| 447 | continue |
| 448 | } |
| 449 | fmt.Fprint(w, num) |
| 450 | if wtyp != protowire.StartGroupType { |
| 451 | w.WriteByte(':') |
| 452 | } |
| 453 | if !w.compact || wtyp == protowire.StartGroupType { |
| 454 | w.WriteByte(' ') |
| 455 | } |
| 456 | switch wtyp { |
| 457 | case protowire.VarintType: |
| 458 | v, n := protowire.ConsumeVarint(b) |
| 459 | if n < 0 { |
| 460 | return |
| 461 | } |
| 462 | b = b[n:] |
| 463 | fmt.Fprint(w, v) |
| 464 | case protowire.Fixed32Type: |
| 465 | v, n := protowire.ConsumeFixed32(b) |
| 466 | if n < 0 { |
| 467 | return |
| 468 | } |
| 469 | b = b[n:] |
| 470 | fmt.Fprint(w, v) |
| 471 | case protowire.Fixed64Type: |
| 472 | v, n := protowire.ConsumeFixed64(b) |
| 473 | if n < 0 { |
| 474 | return |
| 475 | } |
| 476 | b = b[n:] |
| 477 | fmt.Fprint(w, v) |
| 478 | case protowire.BytesType: |
| 479 | v, n := protowire.ConsumeBytes(b) |
| 480 | if n < 0 { |
| 481 | return |
| 482 | } |
| 483 | b = b[n:] |
| 484 | fmt.Fprintf(w, "%q", v) |
| 485 | case protowire.StartGroupType: |
| 486 | w.WriteByte('{') |
| 487 | w.indent++ |
| 488 | default: |
| 489 | fmt.Fprintf(w, "/* unknown wire type %d */", wtyp) |
no test coverage detected