Open christophberger opened 1 year ago
Migrated comment, written by wasatchwizard on 03/04/2017 16:35:51
I have a couple questions about the Mutex locking.
First, wouldn't it be better (ie: block for less time) if I were to assign the k and v values before locking the mutex? Do the variable assignments need to be inside the Lock block?
Second, shouldn't you use a locked RWMutex before reading values from data[] in the show() method?
Nice article!
Migrated comment, written by Christoph on 03/05/2017 21:23:02
Short answer: Yes and yes.
You are completely right in both cases. The mutex is only required for the data map, and it can (should) be an RWMutex. I fixed the code in the article. (I did not fix it in the video BTW, because replacing a video on YouTube changes the video's unique URL, and this would break all links and bookmarks.)
Migrated comment, written by Ciprian-Mihai Stafie on 05/29/2020 13:40:03
In case of the put request (update) I get: Method not allowed. Any ideea why?
Migrated comment, written by Christoph on 05/31/2020 20:30:31
For other readers, we discussed the problem and it turned out that curl sent a GET request.
To tell curl to send a PUT, pass the -X flag (this is an uppercase X)
Written on 02/25/2017 15:19:55
URL: https://appliedgo.net/rest/