Evan Moses

My blog and projects

  • Representing State as interfaces in Go

    I made up a neat little pattern in Go the other day. It’s a way to represent a state change in a system by exposing different APIs for different states, while only holding state in a single underlying struct. I’m sure I’m not the first person to invent this, and it may already a name, so please let me know if you know of one [Update: apg on Lobsters pointed out the name “typestate”, which I like].

    Read more…
  • Building a custom Emacs auth-source

    My employer, Okta, has recently been making security improvements to how we access all sorts of internal systems. As part of that hardening, we’ve been disallowed from using SSH keys and long-lived GitHub tokens to access our code on GitHub. In place of that, we’ve now got an internal tool that grants us short-lived tokens on demand, after SSOing (through Okta of course). This is a good idea even if it adds a little friction, and means that if you gain access to my machine somehow you won’t automatically have my privileges to access our code base.

    Read more…