| 1 | //go:build ignore |
|---|---|
| 2 | // +build ignore |
| 3 | |
| 4 | // This is a slice of the fmt package. |
| 5 | |
| 6 | package main |
| 7 | |
| 8 | type pp struct { |
| 9 | field interface{} |
| 10 | } |
| 11 | |
| 12 | func newPrinter() *pp { |
| 13 | return new(pp) |
| 14 | } |
| 15 | |
| 16 | func Fprintln(a ...interface{}) { |
| 17 | p := newPrinter() |
| 18 | p.doPrint(a, true, true) |
| 19 | } |
| 20 | |
| 21 | func Println(a ...interface{}) { |
| 22 | Fprintln(a...) |
| 23 | } |
| 24 | |
| 25 | func (p *pp) doPrint(a []interface{}, addspace, addnewline bool) { |
| 26 | print(a[0]) // @types S | string |
| 27 | stringer := a[0].(interface { |
| 28 | String() string |
| 29 | }) |
| 30 | |
| 31 | stringer.String() |
| 32 | print(stringer) // @types S |
| 33 | } |
| 34 | |
| 35 | type S int |
| 36 | |
| 37 | func (S) String() string { return "" } |
| 38 | |
| 39 | func main() { |
| 40 | Println("Hello, World!", S(0)) |
| 41 | } |
| 42 | |
| 43 | // @calls (*command-line-arguments.pp).doPrint -> (command-line-arguments.S).String |
| 44 |
Members