Resources
Resource | Notes |
---|---|
Goroutines & Closures | Important caveat on shadowing variable in loops included |
Using uiprogress | Notes I wrote about trying threadsafe progress bar package |
Using Goroutines with CLI Tools
Running CLI tools via goroutines can speed up slow actions like code generation. I prefer to run these types of actions with a buffered channel to throttle the requests and avoid overloading my laptop. 🔥
Here’s an example using Pterm output for reporting progress (no progress bar)1.
Playground - Go :fontawesome-solid-link:
|
|
-
Since things are running concurrently, a single bar isn’t quite accurate. There are libraries that report correctly with goroutines, but as of 2023-03, pterm isn’t one of them. However, it’s under development. ↩︎
Webmentions
(No webmentions yet.)