golang.org/x/tools@v0.21.1-0.20240520172518-788d39e776b1/go/callgraph/vta/testdata/src/callgraph_fields.go (about) 1 // Copyright 2021 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // go:build ignore 6 7 package testdata 8 9 type I interface { 10 Foo() 11 } 12 13 type A struct { 14 I 15 } 16 17 func (a *A) Do() { 18 a.Foo() 19 } 20 21 type B struct{} 22 23 func (b B) Foo() {} 24 25 func NewA(b B) *A { 26 return &A{I: &b} 27 } 28 29 func Baz(b B) { 30 a := NewA(b) 31 a.Do() 32 } 33 34 // WANT: 35 // Baz: (*A).Do(t0) -> A.Do; NewA(b) -> NewA 36 // A.Do: invoke t1.Foo() -> B.Foo