Testing Go with Monty (Python)
Testing Go with Monty (Python)
April 2026
Not much to say right now besides it works.
1package main
2
3import (
4 "context"
5 "fmt"
6 "log"
7
8 monty "github.com/ewhauser/gomonty"
9)
10
11var a = `
12def add(x):
13 return x + 1
14
15add(x)
16`
17
18func main() {
19 runner, err := monty.New(a, monty.CompileOptions{
20 Inputs: []string{"x"},
21 })
22 if err != nil {
23 log.Fatal(err)
24 }
25
26 value, err := runner.Run(context.Background(), monty.RunOptions{Inputs: map[string]monty.Value{"x": monty.Int(10000)}})
27 if err != nil {
28 log.Fatal(err)
29 }
30
31 fmt.Println(value.Raw())
32}
It will be interesting if this enables greater scripting capabilities when integrating things into other languages.