From 3f2ee3762b27953c6c7baacbc2d3d0a33781e131 Mon Sep 17 00:00:00 2001 From: Raiane-Dev Date: Thu, 16 May 2024 16:32:39 -0300 Subject: [PATCH 1/2] adding support to 'plugin' package --- stdlib/go1_22_plugin.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 stdlib/go1_22_plugin.go diff --git a/stdlib/go1_22_plugin.go b/stdlib/go1_22_plugin.go new file mode 100644 index 000000000..0abab9383 --- /dev/null +++ b/stdlib/go1_22_plugin.go @@ -0,0 +1,19 @@ +// Code generated by 'yaegi extract plugin'. DO NOT EDIT. + +//go:build go1.22 +// +build go1.22 + +package stdlib + +import ( + "plugin" + "reflect" +) + +func init() { + Symbols["plugin/plugin"] = map[string]reflect.Value{ + "Open": reflect.ValueOf(plugin.Open), + "Plugin": reflect.ValueOf((*plugin.Plugin)(nil)), + "Symbol": reflect.ValueOf((*plugin.Symbol)(nil)), + } +} From 97589eb4195ab7ac3c4c412f6446daf5add88902 Mon Sep 17 00:00:00 2001 From: Raiane-Dev Date: Fri, 2 Aug 2024 12:31:40 -0300 Subject: [PATCH 2/2] feature: added the plugin package to the list of packages for which wrappers are generated in yaegi/stdlib/stdlib.go --- stdlib/go1_21_plugin.go | 30 ++++++++++++++++++++++++++++++ stdlib/go1_22_plugin.go | 21 ++++++++++++++++----- stdlib/stdlib.go | 1 + 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 stdlib/go1_21_plugin.go diff --git a/stdlib/go1_21_plugin.go b/stdlib/go1_21_plugin.go new file mode 100644 index 000000000..083758c6b --- /dev/null +++ b/stdlib/go1_21_plugin.go @@ -0,0 +1,30 @@ +// Code generated by 'yaegi extract plugin'. DO NOT EDIT. + +//go:build go1.21 && !go1.22 +// +build go1.21,!go1.22 + +package stdlib + +import ( + "plugin" + "reflect" +) + +func init() { + Symbols["plugin/plugin"] = map[string]reflect.Value{ + // function, constant and variable definitions + "Open": reflect.ValueOf(plugin.Open), + + // type definitions + "Plugin": reflect.ValueOf((*plugin.Plugin)(nil)), + "Symbol": reflect.ValueOf((*plugin.Symbol)(nil)), + + // interface wrapper definitions + "_Symbol": reflect.ValueOf((*_plugin_Symbol)(nil)), + } +} + +// _plugin_Symbol is an interface wrapper for Symbol type +type _plugin_Symbol struct { + IValue interface{} +} diff --git a/stdlib/go1_22_plugin.go b/stdlib/go1_22_plugin.go index 0abab9383..2c425e86d 100644 --- a/stdlib/go1_22_plugin.go +++ b/stdlib/go1_22_plugin.go @@ -11,9 +11,20 @@ import ( ) func init() { - Symbols["plugin/plugin"] = map[string]reflect.Value{ - "Open": reflect.ValueOf(plugin.Open), - "Plugin": reflect.ValueOf((*plugin.Plugin)(nil)), - "Symbol": reflect.ValueOf((*plugin.Symbol)(nil)), - } + Symbols["plugin/plugin"] = map[string]reflect.Value{ + // function, constant and variable definitions + "Open": reflect.ValueOf(plugin.Open), + + // type definitions + "Plugin": reflect.ValueOf((*plugin.Plugin)(nil)), + "Symbol": reflect.ValueOf((*plugin.Symbol)(nil)), + + // interface wrapper definitions + "_Symbol": reflect.ValueOf((*_plugin_Symbol)(nil)), + } +} + +// _plugin_Symbol is an interface wrapper for Symbol type +type _plugin_Symbol struct { + IValue interface{} } diff --git a/stdlib/stdlib.go b/stdlib/stdlib.go index e617a49d6..dbfa321bb 100644 --- a/stdlib/stdlib.go +++ b/stdlib/stdlib.go @@ -57,3 +57,4 @@ func init() { //go:generate ../internal/cmd/extract/extract testing testing/fstest testing/iotest testing/quick testing/slogtest //go:generate ../internal/cmd/extract/extract text/scanner text/tabwriter text/template text/template/parse //go:generate ../internal/cmd/extract/extract time unicode unicode/utf16 unicode/utf8 +//go:generate ../internal/cmd/extract/extract plugin