-
If you want Python syntax, https://github.com/google/starlark-go is nice. It is the configuration language interpreter for Bazel, so it is well maintained and stable But that also means features, move slowly and some things that you would find in the standard library for CPython need to be grabbed from a different community maintained repo. It's also, in my opinion, a little less smooth moving back and forth between the scripting language and your code. Code. That said, both are great choices in my opinion. Some people like Lua. I'm sure I would like it if I wanted to spend time on it, but I'm already pretty comfortable with the other choices so I haven't.
-
InfluxDB
InfluxDB β Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
-
expr
Discontinued Expression language and expression evaluation for Go [Moved to: https://github.com/expr-lang/expr] (by antonmedv)
We use https://github.com/antonmedv/expr at some other place for similar case, but there rules are bit simpler and this library seem to suit ideally for such simple "one line" conditions.
-
Googling suggests https://github.com/robertkrimen/otto which allows scripting in javascript for golang projects. This would be definitely enough, but in some way it may be a bit overkill - and scripts supporter shall need some knowledge of javascript which is not always straightforward :)
-
For JS in Go use goja, which offers excellent integration with Go. Also I maintain an extension that adds Common-JS compatibility to it.
-
For JS in Go use goja, which offers excellent integration with Go. Also I maintain an extension that adds Common-JS compatibility to it.
-
If you're curious how I set it up, check out blender/flamenco on Gitlab. The Goja/JS stuff is in internal/manager/job_compilers.
-
If you're interested, I have another project in which I use TypeScript (tsc) to compile to JavaScript/Common-JS that is compatible with goja. It works really well.
-
Stream
Stream - Scalable APIs for Chat, Feeds, Moderation, & Video. Stream helps developers build engaging apps that scale to millions with performant and flexible Chat, Feeds, Moderation, and Video APIs and SDKs powered by a global edge network and enterprise-grade infrastructure.
-
or perhaps use one of this list (depending on who's writing the configuration): https://github.com/dbohdan/embedded-scripting-languages
-
If performance is your main concern, there's Wasmer-go, but if you'd rather avoid CGO dependencies, there's wazero.
-
If performance is your main concern, there's Wasmer-go, but if you'd rather avoid CGO dependencies, there's wazero.
-
Pretty surprised no one has suggested starlark - Very nice ergonomics on both the scripting side and the interpreter. Worth a look! Especially nice when combined with starlight
-
You could also embed a Go interpreter, and have your scripts or expressions in Go. See for example https://github.com/traefik/yaegi. Disclaimer: I'm the author of this project.
-
You should take a look at Grule https://github.com/hyperjumptech/grule-rule-engine