Bodiless function in Golang

It's the way how functions are implemented in assembly. You find the assembly implementation in the floor_ARCH.s (e.g.: AMD64) files.

To quote the spec:

A function declaration may omit the body. Such a declaration provides the signature for a function implemented outside Go, such as an assembly routine.


In my case I had "../../../pkg/mod/golang.org/x/[email protected]/go/ssa/interp/testdata/src/fmt/fmt.go:3:6: missing function body" error!

and it was because I used fmt without importing it so my IDE imported the wrong package.

I fixed it by removing the import (golang.org/x/tools/go/ssa/interp/testdata/src/fmt)

and just importing fmt

Tags:

Function

Go