来回传递字节数组到插件时发生致命错误

I am writing a golang plugin where I need to keep getting a byte array from the plug function and passing it to another function provided by the plugin. However, after a couple of iterations I got this error

fatal error: invalid pointer found on stack

client.go

package main

import (
    "plugin"
    "log"
)

type T interface {
    GenByte() []byte
    PrintByte(data []byte)
}

func main()  {
    plgin, _ := plugin.Open("./plugin.so")
    symbol, _ := plgin.Lookup("Endpoint")
    b, _ := symbol.(T)
    log.Println("From main")
    for{
        data := b.GenByte()
        b.PrintByte(data)
    }


}

plugin.go

package main

import (
    "log"
)

type dummy struct {}

func (d dummy)GenByte() []byte  {
    log.Println("From plugin GenByte")
    data:=[]byte{1,2,3,4,5}
    return data
}

func (d dummy)PrintByte(data []byte)  {
    log.Println("From plugin PrintByte")
    log.Println(data)
}

var Endpoint dummy


func main() {

}

output
2018/07/18 16:47:51 From plugin GenByte
2018/07/18 16:47:51 From plugin PrintByte
2018/07/18 16:47:51 [1 2 3 4 5]
[repeat a number of times]
runtime: bad pointer in frame plugin/unnamed-8b1a52c90a93f94ad1c14cee47dc41ef6a9bc487.dummy.PrintByte at 0xc420055eb0: 0x5
fatal error: invalid pointer found on stack

Update: go version go1.10.3 darwin/amd64

go env

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/yishengyang/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/yishengyang//go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/vh/6m51srdn3ps28tc64qy1343h0000gp/T/go-build637303097=/tmp/go-build -gno-record-gcc-switches -fno-common"