garble: buildmode plugin issue of package not found

The files as follows:

go.mod

module test.com/plugin

go 1.14

dll/dll.go

package dll

import (
	"fmt"
)

type DllInfo struct {
	Name string `json:"name"`
	Id   int32  `json:"id"`
}

func TestDll(name string, id int32) {
	fmt.Printf("check : %v\n", &DllInfo{name, id})
}

main.go

package main

import (
	"test.com/plugin/dll"
)

var TestDll = dll.TestDll

func main() {
	TestDll("asdasfas %v", 111)
}

Then run command:

garble build -buildmode=plugin -o dll.so main.go

Get the errors:

# command-line-arguments
main.go:7:15: undefined: dll.TestDll
exit status 2
exit status 2

It really weird… Seems can not find the package.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (12 by maintainers)

Most upvoted comments

Yes, that’s why the issue is still open.