Debian Codegraph @

test/fixedbugs/issue58300b.go

raw
1 // run
2
3 // Copyright 2023 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 package main
8
9 import (
10 "reflect"
11 "runtime"
12 )
13
14 type T struct {
15 a, b int
16 }
17
18 func f(t *T) int {
19 if t != nil {
20 return t.b
21 }
22 return 0
23 }
24
25 func g(t *T) int {
26 return f(t) + 5
27 }
28
29 func main() {
30 x(f)
31 x(g)
32 }
33 func x(v any) {
34 println(runtime.FuncForPC(reflect.ValueOf(v).Pointer()).Name())
35 }