(b *bytes.Buffer, file string, f *parse.FileSet)
| 150 | } |
| 151 | |
| 152 | func writeLimitConstants(b *bytes.Buffer, file string, f *parse.FileSet) { |
| 153 | if f.ArrayLimit != math.MaxUint32 || f.MapLimit != math.MaxUint32 { |
| 154 | prefix := generateFilePrefix(file) |
| 155 | b.WriteString("// Size limits for msgp deserialization\n") |
| 156 | b.WriteString("const (\n") |
| 157 | if f.ArrayLimit != math.MaxUint32 { |
| 158 | fmt.Fprintf(b, "\t%slimitArrays = %d\n", prefix, f.ArrayLimit) |
| 159 | } |
| 160 | if f.MapLimit != math.MaxUint32 { |
| 161 | fmt.Fprintf(b, "\t%slimitMaps = %d\n", prefix, f.MapLimit) |
| 162 | } |
| 163 | b.WriteString(")\n\n") |
| 164 | |
| 165 | // Store the prefix in FileSet so generators can use it |
| 166 | f.LimitPrefix = prefix |
| 167 | } |
| 168 | } |
no test coverage detected
searching dependent graphs…