| 1 |
// Copyright 2019 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 |
package a |
| 6 |
|
| 7 |
var GS string |
| 8 |
|
| 9 |
func M() string { |
| 10 |
if s := getname("Fred"); s != "" { |
| 11 |
return s |
| 12 |
} |
| 13 |
if s := getname("Joe"); s != "" { |
| 14 |
return s |
| 15 |
} |
| 16 |
|
| 17 |
return string("Alex") |
| 18 |
} |
| 19 |
|
| 20 |
// getname can be any function returning a string, just has to be non-inlinable. |
| 21 |
|
| 22 |
//go:noinline |
| 23 |
func getname(s string) string { |
| 24 |
return s + "foo" |
| 25 |
} |