News for hackers. Stuff that matters.

jminter

Re:How We Centralized and Structured Error Handling in Golang on Thursday December 19, 2024 @02:08PM (#42464694)
Absolutely. An intermediate path in Go is to recover any panics on your goroutines: in this case a nil dereference panic may cause the death of the goroutine but not the whole application.

An example where this can be useful is in HTTP request handling: a single request might fail but the others can keep going -- but there are plenty of other use cases too.

The panic recovery code can log for further investigation, as well as in the HTTP case for example probably returning a 500 to the caller if wanted.

There are of course plenty of valid reasons not to take an approach like this too, but in some circumstances it can be useful.

Re:Short, friendly base32 slugs from timestamps on Thursday January 19, 2023 @11:06AM (#34441807)
Nice post!

To me, "math/big" feels like a big hammer for working on an int64; a nice alternative is "encoding/binary":

  func atomSlug(publishedAt time.Time) string {
      b := make([]byte, 0, 8)
      b = binary.BigEndian.AppendUint64(b, uint64(publishedAt.Unix()))
      b = bytes.TrimLeft(b, "\x00")
      return lexicographicBase32Encoding.EncodeToString(b)
  }
Re:The Case Against Crypto on Friday December 31, 2021 @11:58AM (#29749874)
The argument laid out in this article is a quite complicated edifice, and requires a large amount of knowledge at the intersection of several fields of study

I found this blog post interesting and wish it had a bibliography. Could anyone recommend some approachable sources to read more about the general themes in this post?