Change go code behaviour at runtime

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • go-plugin

    Golang plugin system over RPC.

  • The leader is almost for certain https://github.com/hashicorp/go-plugin which uses RPC. This prevents some of the binary compatibility issues from the standard library option, operating system issues from the standard library option, and it is in use by lots of large projects from Terraform to Packer, Nomad, and Vault.

  • gengine

  • yeah something like grule or https://github.com/bilibili/gengine , how these applications change beahviour at runtime. Don't want to use ANTLR.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • goja

    ECMAScript/JavaScript engine in pure Go

  • For JavaScript syntax, https://github.com/dop251/goja is the most mature and featureful. It operates between Go and the scripting engine pretty well. They still need to implement generators before moving on to async/await and proper module support, but they have a lot of other advanced es6 level features such as classes and format strings. There are soem big consumers of this--the biggest might be Grafana K6, or at least they contribute back a bit. Most of the work (like many small projects) comes from one guy that has a real job, but he's slowly yet steadily made improvements and stuck to following standards for many years now.

  • starlark-go

    Starlark in Go: the Starlark configuration language, implemented in Go

  • For a Python-like syntax, https://github.com/google/starlark-go is the language used in Babel. It's very mature, but since it is used in a massive mature project with a specific purpose, it doesn't move fast or drift from the spec of its Java-based sibling. It doesn't have exception try except blocks or some other features you might expect, but for short extension logic, it might be exactly what you want with the stability you can depend upon.

  • go-lua

    A Lua VM in Go

  • There are lua and Go-script options. My impression is that a few are well accepted but perhaps just a little less widely used than the first two. I cannot speak from personal experience on them. Shopify has a Lua 5.2 port: https://github.com/Shopify/go-lua and I know https://github.com/bitfield/script is one of the Go-like scripting languages, but I think it's more for a shell script replacement than embedding.

  • script

    Making it easy to write shell-like scripts in Go

  • There are lua and Go-script options. My impression is that a few are well accepted but perhaps just a little less widely used than the first two. I cannot speak from personal experience on them. Shopify has a Lua 5.2 port: https://github.com/Shopify/go-lua and I know https://github.com/bitfield/script is one of the Go-like scripting languages, but I think it's more for a shell script replacement than embedding.

  • tengo

    A fast script language for Go

  • There are totally different things like https://github.com/d5/tengo but I don't know much about the docs, communities, or viability of them. Some like this one look very active and healthy. It might be worth considering.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • expr

    Discontinued Expression language and expression evaluation for Go [Moved to: https://github.com/expr-lang/expr] (by antonmedv)

  • I think a number of people use the expr expression language, but I don't know how much functionality it has and how much you need. https://github.com/antonmedv/expr

  • yaegi

    Yaegi is Another Elegant Go Interpreter

  • https://github.com/traefik/yaegi is also a good option

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts