-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does k6 support golang as programming language? #751
Comments
Support for tests written in Go isn't currently planned, but since k6 uses interfaces for the Here are some of the more obvious challenges we have to overcome before adding support for other script languages:
|
|
WASM executors that might be used for running compiled wasm from golang:
All three need investigation for both speed over goja and features that we will need . I mostly linked the cgo one for completeness, I am highly against using something using cgo , if it can be avoided. |
Ah, we probably should have mentioned it here, in case anyone is following the issue... While it's still not possible to write Go "scripts" in k6, it has been possible to write extensions in Go with xk6 since k6 v0.29.0:
Moreover, there is already a basic xk6 extension with support for yaegi, i.e. "go scripting": https://github.com/dgzlopes/xk6-interpret |
Has anyone made a basic test example written in go using xk6 that we can use for reference? "Technically Possible" is a great start to a story of protracted technical adventure. ;) |
Not that I know of, but you can examine some of the many xk6 extensions that already exist for inspiration: https://github.com/search?q=xk6&type=Repositories While most xk6 extensions are meant to be imported from normal JavaScript-based k6 scripts (e.g. export * from "k6/x/myloadtest"; You can create and push metrics from your extensions (see https://github.com/dgzlopes/xk6-remote-write for example) and really do anything you might like with Go code 🤷♂️ Just keep in mind that we don't give any guarantees about the stability of k6 Go APIs, so you might have to adjust the "extension" slightly when new k6 versions are released, though you'd be able to compile it with the old version indefinitely. |
Also, just to reference two basic examples:
On the tutorial that @na-- referenced, there are instructions on how to build the Redis one from scratch. |
Some rationale related to this issue and other similar ones: https://k6.io/blog/why-k6-does-not-introduce-multiple-scripting-languages/ |
I've created an experimental tool that can be intresting in this topic. k6-go |
Closing as not planned. There is another extension that allows you to write tests in golang https://github.com/szkiba/xk6-g0. |
Do we have plan to support golang as programming language? Currently it only support javascript.
The text was updated successfully, but these errors were encountered: