| 1 |
This test verifies that gopls does not panic when encountering the go/types |
| 2 |
bug described in golang/go#59944: the Bindingf function is not included in |
| 3 |
the methodset of its receiver type. |
| 4 |
|
| 5 |
Adapted from the code in question from the issue. |
| 6 |
|
| 7 |
The flag -ignore_extra_diags is included, as this bug was fixed in Go 1.24, so |
| 8 |
that now the code below may produce a diagnostic. |
| 9 |
|
| 10 |
-- flags -- |
| 11 |
-cgo |
| 12 |
-ignore_extra_diags |
| 13 |
|
| 14 |
-- go.mod -- |
| 15 |
module example.com |
| 16 |
|
| 17 |
go 1.12 |
| 18 |
|
| 19 |
-- cgo.go -- |
| 20 |
package x |
| 21 |
|
| 22 |
import "fmt" |
| 23 |
|
| 24 |
/* |
| 25 |
struct layout { |
| 26 |
int field; |
| 27 |
}; |
| 28 |
*/ |
| 29 |
import "C" |
| 30 |
|
| 31 |
type Layout = C.struct_layout |
| 32 |
|
| 33 |
// Bindingf is a printf wrapper. This was necessary to trigger the panic in |
| 34 |
// objectpath while encoding facts. |
| 35 |
func (l *Layout) Bindingf(format string, args ...any) { |
| 36 |
fmt.Printf(format, args...) |
| 37 |
} |