1
0
mirror of https://github.com/golang/go synced 2024-11-19 05:34:40 -07:00
go/pointer/testdata/fmtexcerpt.go

43 lines
649 B
Go
Raw Normal View History

// +build ignore
// This is a slice of the fmt package.
package main
type pp struct {
field interface{}
}
func newPrinter() *pp {
return new(pp)
}
func Fprintln(a ...interface{}) {
p := newPrinter()
p.doPrint(a, true, true)
}
func Println(a ...interface{}) {
Fprintln(a...)
}
func (p *pp) doPrint(a []interface{}, addspace, addnewline bool) {
print(a[0]) // @concrete S | string
stringer := a[0].(interface {
String() string
})
stringer.String()
print(stringer) // @concrete S
}
type S int
func (S) String() string { return "" }
func main() {
Println("Hello, World!", S(0))
}
// @calls (*main.pp).doPrint -> (main.S).String