On Sunday, 21 March 2021 at 11:42:37 UTC Brian Candler wrote:

> Also: somebody has to be responsible for closing the response.  You're not 
> explicitly returning an error from SendNFInstanceRegistration() to 
> HandleNFInstanceRegistration(), so the only way you can indicate that the 
> body is invalid is to return nil as the response pointer.
>
>
Sorry, I got that the wrong way round.  SendNFInstanceRegistration calls 
HandleNFInstanceRegistration, and you do return an error there.

However, PutAndPatch calls SendNFInstanceRegistration, and you don't return 
an error.  The caller then checks resp.StatusCode, but doesn't account for 
the fact that there might have been some error, and so resp is nil.

I would suggest that instead of returning a resp, you return bool "ok" 
which just says whether the request was successful or not.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/5a3230da-a3ab-40a2-a31a-f80743730d70n%40googlegroups.com.

Reply via email to