Timeline for Golang HTTPS certificate expiry checking CLI tool
Current License: CC BY-SA 4.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 27, 2022 at 7:44 | comment | added | preetpalS | I have created a separate thread for the updated code as per your suggestion. | |
Nov 23, 2022 at 11:09 | comment | added | Elias Van Ootegem | @preetpalS: Unlike SO, if you've significantly reworked your code, it's best to post the new version as a separate thread for additional review. Updating the code that has been reviewed makes threads like this makes any posted reviews rather odd for others to read through (as seemingly half of the comments don't apply or relate to the code). | |
Nov 22, 2022 at 19:40 | comment | added | preetpalS | I did notice the added section to the review and I have read it. I also added an updated version of my code so you can see how I followed most of the suggestions in your review (note that there may be naming issues still that I did not correct and I know about the unnecessary escaping in the multi-line string). | |
Nov 22, 2022 at 15:42 | comment | added | Elias Van Ootegem | @preetpalS In case you didn't notice, I've added a section to my review in which I go in to your question in a bit more detail, with some code examples, and touch upon some of these edge cases (like import masking). I'm going to add one more example WRT arguments in anonymous functions that should make it very clear why sometimes we have to pass arguments | |
Nov 18, 2022 at 10:47 | history | edited | Elias Van Ootegem | CC BY-SA 4.0 |
added 6821 characters in body
|
Nov 18, 2022 at 10:19 | comment | added | Elias Van Ootegem | as for functions (anonymous functions and scope), the rule of thumb here would be that masking variables or packages from a higher scope would prompt you to pass the variables in as arguments, as well as using routines, or functions to call later on which use loop vars have to be passed in as arguments | |
Nov 18, 2022 at 10:16 | comment | added | Elias Van Ootegem | The rest would be waiting for the routine that reads these channels before it can write its result onto the channel. In the snippets I provided, the writes on these channels happen in a single routine, but in reality you'd check the certs in 1 routine per URL. TL;DR the buffer of 10 still allows for more routines to be spawned, it only "limits" how many of them can terminate at any given time. As long as reading from the channels is faster than populating the channel, though, a buffer of 10 is unlikely to be a bottleneck | |
Nov 18, 2022 at 10:13 | comment | added | Elias Van Ootegem |
As for the returns: nil, someErr is kind of the norm, akin to option/match constructs. The buffer sizes of 10 limits the number of routines in the sense that it's a cap on the backlog that is allowed to build up. You can have no more than 10 routines waiting to be able to write to these channels. The processURLs call is not blocking, so the caller is expected to immediately start receiving data from these channels, freeing up space for more routines, so you could have, say, 100 routines actually checking the certificates, 10 can instantly write success (+ 10 error)...
|
|
Nov 17, 2022 at 23:38 | comment | added | preetpalS | Another point I was hoping for feedback on was the anonymous function that I used in the processUrlsParallel function (I know that it would be more appropriate to use the term concurrent in its name) and the multiple arguments that it takes. Do you have any recommendations on which ones (function arguments) should have been captured by closure versus which ones should remain arguments? | |
Nov 17, 2022 at 23:31 | comment | added | preetpalS | Right now I am planning on following the advice for returning a pointer to a JSONSuccessResponse, is it safe to assume that this is the best way to indicate that there was nothing to return (an alternative would be an option type in another language)? In your implementation of processURLs you created a buffered JSONSuccess channel of size 10, I know goroutines are independent of system threads but doesn't the size of the buffered channel here limit concurrency (is 10 a magic number or am I wrong in my assumption)? What are your thoughts on the use of GUIDs in the error messages? | |
Nov 17, 2022 at 23:19 | comment | added | preetpalS | I have some questions: | |
Nov 17, 2022 at 23:18 | comment | added | preetpalS | Honestly, this feedback is very valuable. I really appreciate it (it's going to take me a while to go through it all in-depth). Honestly, I should have seen the control flow issues (unnecessary if/else, not using an early returns) prior to posting this code. I am going to modify the code to use directional channels. | |
Nov 17, 2022 at 22:57 | vote | accept | preetpalS | ||
Nov 17, 2022 at 19:31 | history | answered | Elias Van Ootegem | CC BY-SA 4.0 |