HNHacker News
TopNewBestAskShowJobs

a-poor

56 karma · joined July 21, 2021

Fullstack developer living in Los Angeles, CA.

https://austinpoor.com

submissionscomments
a-poor··on New research suggests people can communicate and practice skills while dreaming
Synthetic training data
a-poor··on Why Go Can't Try
What is broken about the go error type? If anything the fact that it is a simple interface makes the `try` syntax sugar more doable – right?

Let's say you have this:

``` part, err := doSomething() if err != nil { return nil, err }

data, err := somethingElse(part) if err != nil { return nil, err }

return data, nil ```

Then as long as your function followed the contract 0+ returns and then 1 `error` return, that could absolutely be turned into just the 0+ returns and auto-return error.

The fact that the `Error` interface is easy to match and extend, plus the common pattern of adding an error as the last return makes this possible.

What am I missing here?

a-poor··on Waitgroups: What they are, how to use them and what changed with Go 1.25
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··on On Zero Trust Programming: Applying the Concepts of Zero Trust Security to Code
I would love to -- I'm planning to start with something on the smaller side as a PoC.
a-poor··on Building a Custom URL Shortener with Rust
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.