NeedsInvestigationcompiler/runtimehelp wanted
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
The language permits omitting the method body. However, the error message for this could be clearer.
Test case (uses import "C" to force the compiler to assume that method bodies are defined elsewhere):
package main
import "C"
type S struct{}
func (S) M()
var Sink interface{}
func main() {
Sink = S{}
}
Running go build foo.go produces
type.main.S: relocation target main.S.M not defined
This error message is accurate but conveys little information to someone unfamiliar with linker jargon like "relocation target." We should instead say "missing function body", though unfortunately it may be difficult to give a good file/line position for the declaration with the missing body.