Source file
test/fixedbugs/issue24547.go
1
2
3
4
5
6
7
8
9
10
11 package main
12
13 import (
14 "bytes"
15 "fmt"
16 )
17
18 type mystruct struct {
19 f int
20 }
21
22 func (t mystruct) String() string {
23 return "FAIL"
24 }
25
26 func main() {
27 type deep struct {
28 mystruct
29 }
30 s := struct {
31 deep
32 *bytes.Buffer
33 }{
34 deep{},
35 bytes.NewBufferString("ok"),
36 }
37
38 if got := s.String(); got != "ok" {
39 panic(got)
40 }
41
42 var i fmt.Stringer = s
43 if got := i.String(); got != "ok" {
44 panic(got)
45 }
46 }
47
View as plain text