Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I used go-starlark[1] to build a configurable reverse proxy and container manager for web app deployment [2]. Starlark is used to configure the proxy and it can be used to actually implement the backend apis.

One challenge with Starlark was not having exceptions, which by itself is a good thing. But not having go-style multi-value returns in Starlark makes error handling verbose. Since the errors originate in plugin calls to go code, the solution I implemented was a thread-local to store the last error and handle that on the next plugin call if the error was not explicitly handled in the code [3]. Worked out pretty well in my test apps. For example, this app [4] implements a bookmark manager, with minimal error handling required in the code.

Starlark is great for adding dynamic behavior for go applications. I was worried about performance when I started but perf has not been a concern in the context of a web app server.

[1] https://github.com/google/starlark-go

[2] https://github.com/claceio/clace

[3] https://clace.io/docs/plugins/overview/#automatic-error-hand...

[4] https://github.com/claceio/apps/blob/main/utils/bookmarks/ap...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: