Great - glad it's solved. I was only going to suggest you insert more logging calls all over the place until you find the problem :-)
On Sunday, 21 March 2021 at 13:45:16 UTC Van Fury wrote: > > Hi, > > I have found the problem to the double PUT message being sent and have > solve it. > Thanks for the help. > > A lot of lesson learnt from this exercise. > > On Sunday, March 21, 2021 at 1:47:07 PM UTC+2 Brian Candler wrote: > >> 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/2f1f4950-9e35-42ff-adf0-7fe68fc28c94n%40googlegroups.com.