Hi @vishalkuo, welcome to the community forum!
You can and should completely drop common.Bind
for this use case.
It has one function and it is to facilitate the use of context
in k6:
To wrap the methods of a struct which take context
as the first argument … to actually get it when called from js code, without their first argument at the call site being a context
object ;). This is already being done for each module such as yours due to the way modules.Register
(and other things) work.
If you need to return an object that then will have to be called with context, as in the grpc
module or metrics
, you will need to use common.Bind
, and at that point, we are actually moving around a different object and the current implementation does not support getting the original one in some way so … .
If this is your use case - please open an issue.
Hope this clears things out and helps you