0$ export GOPATH=/some/where/
1$ go get github.com/erning/gorun
2$ apt install binfmt-support
3$ cat /usr/share/binfmts/golang
package golang
interpreter /some/where/bin/gorun
extension go
credentials yes
4$ sudo update-binfmts --import golang

假设你的 GOPATH 是 /some/where(0),首先安装 gorun 工具(1),其次确认 binfmt-support 工具也安装了(2),
然后添加一个配置文件,文件内容如(3)所示,注意其中的 /some/where/,替换成实际的 GOPATH,
最后,使用 update-binfmts 工具的 import 方法,加载刚刚添加的配置文件。

ref: