github.com/powerman/golang-tools@v0.1.11-0.20220410185822-5ad214d8d803/go/callgraph/vta/testdata/src/channels.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 func foo(c chan interface{}, j int) { 10 c <- j + 1 11 } 12 13 func Baz(i int) { 14 c := make(chan interface{}) 15 go foo(c, i) 16 x := <-c 17 print(x) 18 } 19 20 // Relevant SSA: 21 // func foo(c chan interface{}, j int): 22 // t0 = j + 1:int 23 // t1 = make interface{} <- int (t0) 24 // send c <- t1 // t1 -> chan {}interface 25 // return 26 // 27 // func Baz(i int): 28 // t0 = make chan interface{} 0:int 29 // go foo(t0, i) 30 // t1 = <-t0 // chan {}interface -> t1 31 // t2 = print(t1) 32 // return 33 34 // WANT: 35 // Channel(chan interface{}) -> Local(t1) 36 // Local(t1) -> Channel(chan interface{})