Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin: allow code to be in package other than main #18350

Closed
dgnorton opened this issue Dec 16, 2016 · 2 comments
Closed

plugin: allow code to be in package other than main #18350

dgnorton opened this issue Dec 16, 2016 · 2 comments

Comments

@dgnorton
Copy link

What version of Go are you using (go version)?

1.8 beta 2

What operating system and processor architecture are you using (go env)?

Ubuntu 14.04

Currently, the plugin package requires that code be in package main. It would be convenient if plugins could be built from any existing package. This would allow a package to be statically linked in the usual way or built as a plugin in a shared library. To do this now, a separate directory needs to be created with a .go file in package main that imports the package to be built as a plugin.

In this discussion, on golang-nuts, @ianlancetaylor suggested that it might be possible by giving a list of packages to the go tool that should be included in the plugin and then the go tool could generate the main package that imports the specified packages.

@minux
Copy link
Member

minux commented Dec 19, 2016 via email

@rakyll
Copy link
Contributor

rakyll commented Dec 21, 2016

Let's keep the conversation on #18124. @dgnorton's suggestion is already considered over there and non-main symbols not being exported for the plugin buildmode seems to be a blocker.

@rakyll rakyll closed this as completed Dec 21, 2016
@golang golang locked and limited conversation to collaborators Dec 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants