
🌲Environmentalist | Tinkerer @TutorialEdge | 👨💻 Staff Software Engineer @CircleCi, ex-@ImagineCurve, ex-@JPMorgan | https://teapaw.org/t.co/pmayy2cODY 🚀 he/him
🌲🌱⬜ ⬜ ⬜ ⬜ ⬜ ⬜ ⬜ ⬜ 100k trees
Joined March 2011
- Tweets4K
- Following1.2K
- Followers2.9K
- Likes3.9K
Elliot Forbes 🏴 retweeted
👀 My latest article (and also the first in a long time) is now live on the site!
Covering the new iterators syntax in Go! Let me know what you think!
tutorialedge.net/golang/go-1…
Elliot Forbes 🏴 retweeted
Excellent blog post
tailscale.com/blog/new-inter…
Elliot Forbes 🏴 retweeted
The single most important thing I have learned about software development over my career is that if you do not aggressively fight complexity, it will eat you alive.
Elliot Forbes 🏴 retweeted
CrowdStrike effectively bricked windows, Mac and Linux today.
Windows machines won’t boot, and Mac and Linux work is abandoned because all their users are on twitter making memes.
Incredible work.
Elliot Forbes 🏴 retweeted
#linux users right now 🐧
Elliot Forbes 🏴 retweeted
You know who isn’t in jail? Bosses of companies who poisoned our waters while making record profits
BREAKING: Five Just Stop Oil protesters, including one of its co-founders, have been jailed - with one sentenced to five years and the other to four news.sky.com/story/just-stop…
Elliot Forbes 🏴 retweeted
Last year the transport minister was promoting conspiracy theories about fifteen minute cities. Now the new one is reading books about cycle infrastructure. I don't need them to be perfect, to do precisely what I'd want done, but my god it's so great that they're good.
This post is from an account that no longer exists. Learn more
Elliot Forbes 🏴 retweeted
How many folks are performance profiling in their systems?
I'm curious to see if this is a fairly common thing that teams have the capacity, and are willing to invest time in, or if it's only a minor subset of developers out in the wild that have ever had to do this.
21%Fairly Regularly
58%Infrequently
21%Never
19 votes • Final results Elliot Forbes 🏴 retweeted
After many requests, you can now get a physical copy of Foundations of Debugging with Go on Amazon globally.
Check it out, and please leave a review if you do. It really helps :)
mybook.to/bpk7T8
Elliot Forbes 🏴 retweeted
They now control three nearby elementary schools and the local McDonalds pays them tribute.
Elliot Forbes 🏴 retweeted
Elliot Forbes took this photo of Glen Coe
Take a look at this week’s picture gallery ➡️ bit.ly/42b0RCN
Send your great photos of Scotland to [email protected]
Elliot Forbes 🏴 retweeted
Setting up a local tracing stack for my course and I am impressed with how easy it all is.
This is the simplest docker-compose file I have ever written.
Elliot Forbes 🏴 retweeted
Retweets massively appreciated.
Today, I'm excited to announce the waitlist for my first ever course, The Ultimate Guide to Debugging in Go.
Debugging is probably the most important skills that you never get taught. It is usually the first thing I teach folks and it's often quoted as the most useful thing they learnt from me.
I'm still working hard to get the course finished, but if you want to get access before anyone else and a tasty discount code, you can join the waitlist here:
bytesizego.com/the-ultimate-…
#golang
Elliot Forbes 🏴 retweeted
Cruella Braverman today says ‘net zero but not at the expense of the British People’ - it’s so dishonest, an entirely false choice, in effect a lie (done knowingly)…. Net zero will boost our economy, the OBR made it clear last month that sticking with fossils will cost twice as much as the move to renewables. Who are these fools running our country into the ground? - and constantly pointing in the wrong direction….
Elliot Forbes 🏴 retweeted
HugOps to all the folks at @github, something must be properly on fire 🔥
There's been multiple incidents in the last 24 hrs on core things like code loading and git operations being mega slow and now pretty much all of GitHub is sporadically 500ing
Elliot Forbes 🏴 retweeted
Functional Options Pattern in Go
The functional options pattern in Go offers a flexible and readable way to configure your structs without exposing internal fields.
It is particularly useful when you want to provide optional configuration and there may be more configuration options in the future. Great for libraries!
Let's see an example. Here is a super basic server without functional options.
Over time, our requirements change, and we need to support more configuration options. Instead of changing the signature of the NewServer function, which can be problematic and not backward-compatible, we can use functional options.
Firstly we define a functional option:
and a function that satisfies the type:
modify our NewServer func:
and now we can use it like this (I ran out of images, X only allows me to use 4):
server1 := NewServer("localhost") // uses default port 443
server2 := NewServer("localhost", WithPort(8080))
As you can see, this allows us to offer customisations flexibly, whilst still maintaining readability and not exposing internal fields.
My biggest tip; make sure that your functional options are truly optional. You'll notice in my example that if I do not pass in withPort(), my newServer functional returns a server with a sensible default configuration. This is good practise and this patterns work best for things that are truly optional.
What do you you use functional options for?
Elliot Forbes 🏴 retweeted
💡 The new log/slog package in Go 1.21 brings structured logging to the standard library.
For servers, logging is an important way for developers to observe the detailed behavior of the system, and often the first place they go to debug it.
Learn more ⬇ goo.gle/45MSHBb
Elliot Forbes 🏴 retweeted
errGroups are probably my favourite #golang package.
errGroup makes it really easy to take a bunch of tasks and run them in parallel, making your program faster. They do this whilst keeping your code readable.
Here's an example of one of my most common use-cases I asked chatGPT to generate.
In this example, errGroups are using to make a http call to 3 Get endpoints.
The biggest downside to errGroups is they only return the first error. This means if you want to "collect" errors from all of the above http requests, you would need to take a different approach (I talk about another approach here: blog.cloudflare.com/from-0-t…)
What do you use errGroups for?


























