Comments (4)
I'd like delve to support debugging gomacro too, but plugin
is used to import third party packages at run-time: without it, only the standard Go library can be imported.
Importing third party packages at run-time is such an essential feature that if I have to choose between it and support to debug gomacro, I would decide for the former every time.
from gomacro.
I'm still new to go and just find my check that dynamic import can work without imports/plugin.go
is invalid, as I didn't rebuild gomacro. After I go install github.com/cosmos72/gomacro
with imports/plugin.go
removed, dynamic import does fail, I did have false faith.
And I still want to find a way to have dynamic imports
an opt-in which is off by default, as I'm working on https://github.com/complyue/hbigo , which depends on gomacro to establish a hosted scripting env supporting Go syntax/semantics (and gomacro is the only suitable interpreter atm as I researched), I don't want an (micro service mostly) app depending on my lib destined to lose debuggability always.
Especially those micro services are supposed to expose limited Go func/type to be scriptable (i.e. no dynamic imports). The only workaround to gain debuggability for such an app, I figured out so far, is to remove $GOPATH/src/github.com/cosmos72/gomacro/imports/plugin.go
after installing gomacro.
It's pitty tweaky and I wanna better solutions.
from gomacro.
All the solutions coming to my mind for your use case have significant drawbacks:
- use a different interpreter. There are some around, including at least
- https://github.com/yunabe/lgo - it also includes graphical frontend that you'd need to disable, and it needs by design the plugin package: each statement is compiled with Go compiler into a shared library, then loaded with
plugin.Open()
- https://github.com/gijit/gi - converts Go source to Lua, then runs it with LuaJit. It's very fast for an interpreter, but has limited support to import packages.
- put a customized copy of gomacro into the vendor/ directory of your project, and remove
imports/plugin.go
from it. Unluckily, since the plugin package provides dynamic code loading, there is no way to load it dynamically "on demand".
from gomacro.
@cosmos72 thanks for your insights. lgo is definitely nogo for me, and I don't think the interpreted invocation of micro service funcs will create bottlenecks for me, as long as those funcs themselves run with compiled speed, so lua based or other jits are not attempting to me too. I think I'd stick with gomacro, the tweaky way to debug app can be tolerable in the near future, tho not perfect.
from gomacro.
Related Issues (20)
- I would like a full working example how to inject my application context(types and functions) in the REPL HOT 9
- Extract struct with methods from script to compiled code HOT 2
- Proxy can mix the called method of the imported structure HOT 3
- integrate with https://github.com/go-rod/rod HOT 2
- I'm unable to compile code importing gomacro on Mac OS m1 pro HOT 7
- Is there a way to Eval a folder HOT 5
- recursive type error cases: call of reflect.Value.Interface on zero Value HOT 6
- can't import fsm package HOT 4
- Different compilation behaviour from native go HOT 2
- undefined: pkgpath HOT 3
- Cannot convert struct to interface if it has an embedded struct with a method HOT 4
- Cannot import third party packages on Linux (not even the ones in the README) HOT 2
- Third-party imported type method is not callable from fast.Interp.Eval [gomacro repl works] HOT 4
- Idea for making adding third party packages to Gomacro easier when plugins aren't available HOT 3
- recursive type error cases: call of reflect.Value.Interface on zero Value
- can not import 3rd party packages HOT 13
- package <package> exports zero constants, functions, types, and variables HOT 3
- Caching of interp.Eval1 results HOT 13
- Way to disable go get import and enforce to use only defined import list HOT 3
- An error will be reported when using third-party packages on Windows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gomacro.