Re: [go-nuts] Using nested struct to save master-detail POST request

2021-03-21 Thread Shulhan
On Sun, 21 Mar 2021 13:37:18 -0700 (PDT) Hugh Myrie wrote: > I am able to decode the body of a POST request > using json.NewDecoder(r.Body)., then save the result to a database. > > Example: > > type Product struct { > IDint `json:"id"` > Description string `json:"description"` > Pr

Re: [go-nuts] No Generics - Type Binding on Imports

2021-03-21 Thread Ian Lance Taylor
On Sun, Mar 21, 2021 at 1:02 PM Martin Leiser wrote: > > I think so. But How? Remember we need to do two things: > > - A way to define type parameters. > > - A way to bind the type parameters to concrete types at compile time Thanks for the note. I think that a generics proposal needs to

[go-nuts] Using nested struct to save master-detail POST request

2021-03-21 Thread Hugh Myrie
I am able to decode the body of a POST request using json.NewDecoder(r.Body)., then save the result to a database. Example: type Product struct { IDint `json:"id"` Description string `json:"description"` Price float64 `json:"price"` Packsize int `json:"packsize"` Count1 int `json:"c

[go-nuts] Code Review Checklist: Go Concurrency

2021-03-21 Thread Roman Leventov
I've created a list of possible concurrency-related bugs and gotchas in Go code: https://github.com/code-review-checklists/go-concurrency. The idea of this list is to accompany https://github.com/golang/go/wiki/CodeReviewComments and https://golang.org/doc/articles/race_detector#Typical_Data_Ra

[go-nuts] No Generics - Type Binding on Imports

2021-03-21 Thread Martin Leiser
Hi there I am aware that the proposal to add generics has been accepted , so the discussion of whether or not Go will get generics is answered. For better or for worse. I worked on a different approach since a few years, not v

[go-nuts] Re: How to design HTTP request between HTTP servers

2021-03-21 Thread Brian Candler
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

[go-nuts] Re: How to design HTTP request between HTTP servers

2021-03-21 Thread Van Fury
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: so

[go-nuts] Re: How to design HTTP request between HTTP servers

2021-03-21 Thread Van Fury
Hi, Line line 147 of register.go is status code check in the second for loop but now solved. if res.StatusCode != http.StatusNoContent { But i still could not find out why the SendNFInstanceRegistration() message is send twice even though i have check the responses here fmt.Print("sta

[go-nuts] Re: How to design HTTP request between HTTP servers

2021-03-21 Thread Brian Candler
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 i

[go-nuts] Re: How to design HTTP request between HTTP servers

2021-03-21 Thread Brian Candler
On Sunday, 21 March 2021 at 11:20:40 UTC Van Fury wrote: > After this , the PATCH message is send OK but when server B stop running, > server A break, complain g about the status check in the PATCH for loop > > status204ERRO[0350] Patch " > http://127.0.0.1:9090/nnrf-nfm/v1/nf-instances/6ba7b810-9

[go-nuts] Re: How to design HTTP request between HTTP servers

2021-03-21 Thread Brian Candler
On Saturday, 20 March 2021 at 19:19:53 UTC Van Fury wrote: > OK, if I understand you correctly, the outer for loop is not needed and > that > there should be two for loops. > the first for loop does step 1,2 and 3 and then "break" out of the loop > when valid response is received > and then set

[go-nuts] Re: How to design HTTP request between HTTP servers

2021-03-21 Thread Van Fury
Hi, This is what i have done so far but still having problems. When server A starts and server B is not available, it retry but if server B start running, sever A sends the PUT message in the SendNFInstanceRegistration(). When i print the status code in SendNFInstanceRegistration() i get stat