digitalocean / go-libvirt

Package libvirt provides a pure Go interface for interacting with Libvirt. Apache 2.0 Licensed.
Apache License 2.0
928 stars 127 forks source link

suggested breaking change: add context.Context support to API #182

Open connorkuehl opened 1 year ago

connorkuehl commented 1 year ago

Client code would benefit a lot from context cancellation support. I suspect we could update the code generator to add context.Context parameters that many Go programmers might already be used to and thread those through to Libvirt.getResponse.

Perhaps this breaking change is the line we could cross to cut a v1 module of go-libvirt to avoid breaking client code in a confusing way.

sam-github commented 1 year ago

I don't think it would have to be breaking, the non-ctx variants, and explicit timeout arg variants, could all be written backwards compatibly in terms of the APIs that have a ctx arg. Some of the golang core APIs did this, they have a ...WithCtx(ctx, ..) or just ...Ctx(ctx, ...) version.