Kong / go-kong

Go binding for Kong's admin API
Apache License 2.0
88 stars 40 forks source link

Linter dislikes unclosed body #273

Open rainest opened 1 year ago

rainest commented 1 year ago

https://github.com/Kong/go-kong/blame/e7e15d83eeebe60fdeb85ea1be93df17c7cdc3bf/kong/client.go#L241 makes https://github.com/timakin/bodyclose unhappy because we do indeed not close the body. It apparently did not care about this last year.

We're doing weird things where we never technically read, but do copy the body, and absent any obvious failure (none has appeared in the year since this was added) I'm deferring this as a chore til later.

rainest commented 1 year ago

Attempting to close the body as one normally would causes all sorts of fun: https://github.com/Kong/go-kong/pull/271#discussion_r1095119621

We need to untangle something with how the copy/decode after works, as it's apparently currently destroying the body and making it impossible to close.