I want to build an API to return all of the global variables inside a package. I use go/importer
to import the package. It works fine on my local machine, but when I deployed the binary, It is not working. It says can't find import
. FYI, I only deployed the binary without the source code.
Here is the sample code
defaultImporter := importer.For("gc", nil)
modelsPkg, err := defaultImporter.Import("github.com/foo/bar/models")
Is there any way to import a package inside the binary ?
Thanks in advance