(p *gen.Printer)
| 384 | } |
| 385 | |
| 386 | func (fs *FileSet) applyDirs(p *gen.Printer) { |
| 387 | // apply directives of the form |
| 388 | // |
| 389 | // //msgp:encode ignore {{TypeName}} |
| 390 | // |
| 391 | loop: |
| 392 | for _, d := range fs.Directives { |
| 393 | chunks := strings.Split(d, " ") |
| 394 | if len(chunks) > 1 { |
| 395 | for i := range chunks { |
| 396 | chunks[i] = strings.TrimSpace(chunks[i]) |
| 397 | } |
| 398 | m := strToMethod(chunks[0]) |
| 399 | if m == 0 { |
| 400 | warnf("unknown pass name: %q\n", chunks[0]) |
| 401 | continue loop |
| 402 | } |
| 403 | if fn, ok := passDirectives[chunks[1]]; ok { |
| 404 | pushstate(chunks[1]) |
| 405 | err := fn(m, chunks[2:], p) |
| 406 | if err != nil { |
| 407 | warnf("error applying directive: %s\n", err) |
| 408 | } |
| 409 | popstate() |
| 410 | } else { |
| 411 | warnf("unrecognized directive %q\n", chunks[1]) |
| 412 | } |
| 413 | } else { |
| 414 | warnf("empty directive: %q\n", d) |
| 415 | } |
| 416 | } |
| 417 | p.CompactFloats = fs.CompactFloats |
| 418 | p.ClearOmitted = fs.ClearOmitted |
| 419 | p.NewTime = fs.NewTime |
| 420 | p.AsUTC = fs.AsUTC |
| 421 | p.ArrayLimit = fs.ArrayLimit |
| 422 | p.MapLimit = fs.MapLimit |
| 423 | p.MarshalLimits = fs.MarshalLimits |
| 424 | p.LimitPrefix = fs.LimitPrefix |
| 425 | } |
| 426 | |
| 427 | func (fs *FileSet) PrintTo(p *gen.Printer) error { |
| 428 | fs.applyDirs(p) |
no test coverage detected