Copies string to buffer (which must be big enough), and converts buffer slice containing the string copy into new string.
(in string, buf []byte)
| 97 | // Copies string to buffer (which must be big enough), and converts buffer slice containing |
| 98 | // the string copy into new string. |
| 99 | func copyStringToBuffer(in string, buf []byte) (string, []byte) { |
| 100 | l := len(in) |
| 101 | c := copy(buf, in) |
| 102 | if c != l { |
| 103 | panic("not copied full string") |
| 104 | } |
| 105 | |
| 106 | return yoloString(buf[0:l]), buf[l:] |
| 107 | } |
| 108 | |
| 109 | // FromLabelsToLabelAdapters casts labels.Labels to []LabelAdapter. |
| 110 | // It uses unsafe, but as LabelAdapter == labels.Label this should be safe. |
no test coverage detected