Readit News logoReadit News
a-poor commented on Waitgroups: What they are, how to use them and what changed with Go 1.25   mfbmina.dev/en/posts/wait... · Posted by u/mfbmina
a-poor · 7 days ago
This means you can't pass variables in as function arguments. Even the example in the official go docs doesn't handle the scope correctly:

  func main() {
   var wg sync.WaitGroup
   var urls = []string{
    "http://www.golang.org/",
    "http://www.google.com/",
    "http://www.example.com/",
   }
   for _, url := range urls {
    // Launch a goroutine to fetch the URL.
    wg.Go(func() {
     // Fetch the URL.
     http.Get(url)
    })
   }
   // Wait for all HTTP fetches to complete.
   wg.Wait()
  }
https://pkg.go.dev/sync#example-WaitGroup

You need to use this pattern instead:

   for _, url := range urls {
    url := url
    // ...

a-poor commented on On Zero Trust Programming: Applying the Concepts of Zero Trust Security to Code   austinpoor.com/blog/zero-... · Posted by u/a-poor
banjo-rogue · 2 years ago
are you planning to implement in javascript?
a-poor · 2 years ago
I would love to -- I'm planning to start with something on the smaller side as a PoC.
a-poor commented on Building a Custom URL Shortener with Rust   austinpoor.com/blog/apoor... · Posted by u/a-poor
a-poor · 2 years ago
Delve into the world of Rust development with this blog post on creating a custom URL shortener, complete with tech stack analysis, middleware integration, and load testing.

u/a-poor

KarmaCake day54July 21, 2021
About
Fullstack developer living in Los Angeles, CA.

https://austinpoor.com

View Original