loong / go-concurrency-exercises

Hands on exercises with real-life examples to study and practice Go concurrency patterns. Test-cases are provided to verify your answers.
Other
1.17k stars 401 forks source link

Improvement changes to exercise 2 #33

Closed malfple closed 1 year ago

malfple commented 1 year ago

Hello,

I want to add some things to exercise 2 to help strengthen the testcases. Also makes use of the go.mod that you added recently.

  1. Added assert lib
  2. Checks the return of the cache get so that challengers do not implement the cache function incorrectly (sometimes we optimize and make mistakes without realizing).
  3. Checks the number of db calls for the same reason above.
  4. Add an advanced challenge to reduce the runtime even further.

Please let me know if there are errors or inadequacies in these changes.

Thanks!

malfple commented 1 year ago

Glad to hear that! I have resolved the discussions. Feel free to add additional changes and merge the PR. Thanks!