Skip to content
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

Explain how to add a Go package to k6 #1595

Closed
mardukbp opened this issue Aug 17, 2020 · 1 comment
Closed

Explain how to add a Go package to k6 #1595

mardukbp opened this issue Aug 17, 2020 · 1 comment
Labels

Comments

@mardukbp
Copy link

Feature Description

k6 comes with some Go packages, but it may happen that one needs a Go package that is not included.
In my case I needed to generate a CMAC and I had to learn by myself how to do it. This information
should be readily available in the documentation, thus saving users a lot of time and making k6 even
more awesome!

Suggested Solution

A Go package template and instructions for adding it to k6 are provided in my k6gopackage repository.
It should be a good starting point for writing the missing documentation.

@na--
Copy link
Member

na-- commented Aug 18, 2020

Thanks for the suggestion and example repository! In general, we don't think users modifying k6 itself is the best possible UX. While, as you've demonstrated, it's not hard to do, then you'd need to port your changes to every future k6 version.

To get most of the same benefits, but do it in an easier to maintain way, we plan to add plugin support in k6 v0.28.0. You can find more information in the issue (#1353) and PR (#1396). The "JS plugins", which are the only plugin type we'll support initially, look very similar to what I'm seeing in your repo, but wouldn't require users to modify the k6 source itself. They'd still require some advanced knowledge (or future plugin repository and management infrastructure on our side), since they may need to be compiled with the same Go version as k6. The also have some limitations, e.g. they can only work on Windows through Docker (and maybe WSL), because of Go specifics. But, even with both of these considerations, it's likely still better than modifying k6 and having to support a fork, for most use cases. We also plan to extend plugin support in the future to other k6 components, like outputs outputs and executor types, at the very least...

I added a docs issue to document the plugins here when they are merged (grafana/k6-docs#85), so I'll close this one. Feel free to comment in any of the issues I linked to, if you have any feedback on the plugins, since things are still very much subject to change.

@na-- na-- closed this as completed Aug 18, 2020
@na-- na-- mentioned this issue Aug 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants