| This test verifies that gopls does not panic when encountering the go/types |
| bug described in golang/go#59944: the Bindingf function is not included in |
| the methodset of its receiver type. |
| |
| Adapted from the code in question from the issue. |
| |
| The flag -ignore_extra_diags is included, as this bug was fixed in Go 1.24, so |
| that now the code below may produce a diagnostic. |
| |
| -- flags -- |
| -cgo |
| -ignore_extra_diags |
| |
| -- go.mod -- |
| module example.com |
| |
| go 1.12 |
| |
| -- cgo.go -- |
| package x |
| |
| import "fmt" |
| |
| /* |
| struct layout { |
| int field; |
| }; |
| */ |
| import "C" |
| |
| type Layout = C.struct_layout |
| |
| // Bindingf is a printf wrapper. This was necessary to trigger the panic in |
| // objectpath while encoding facts. |
| func (l *Layout) Bindingf(format string, args ...interface{}) { |
| fmt.Printf(format, args...) |
| } |