RSSAmplifier

Blog

Dan Peterson

Recent content on Dan Peterson

danp.netRSS feed ↗14 posts

Latest posts

Transportation and mental health

This is an email I sent to Mayor Andy Fillmore and Councillors Hinch and White on Feburary 27, 2025. An extra link to his Windsor Street Exchange comments added and a couple terms expanded for longer-term context. Hi Mayor, During Tuesday’s Windsor Street Exchange item you said something about the impact of traffic or congestion on people’s mental health. I think you meant because they…

Making the Halifax sidewalk snow clearing map people want

It snows in Halifax! The city clears some sidewalks themselves and contracts out clearing of others. If you want to find out when a sidewalk will be cleared, you need to know or look at: Standards and timelines for sidewalk clearing (be sure you don’t look at street standards by mistake) Priority of the relevant sidewalk (again, be sure you don’t look at the street priorities map by…

Better GitHub Actions caching for Go

I’ve been spending some time on CI improvements at work recently, mostly around cutting down how long things take. As I looked to see if anything about our overall process could be improved, a couple things bothered me: Why, if we were using a pretty standard GitHub Actions setup, were there indications that modules were being downloaded as part of every run? Shouldn’t that all be…

pgx, database/sql transactions, and COPY

At work , we’ve just about completed a migration from the lib/pq Go PostgreSQL driver to pgx . We use the pgx database/sql compatibility layer so our code doesn’t need to care which driver is used, for the most part. As we neared the end of the migration, one unsolved issue remained: using COPY inside transactions. We use COPY in a few places to bulk load data. With lib/pq, that looks…

Coming in Go 1.24: testing/synctest experiment for time and concurrency testing

Testing code that involves time or concurrency can be a struggle. It often leads to hard-to-debug flakes in CI or long-running tests. Go 1.24 is scheduled to be released in February and the release freeze has begun. It’s set to include an experimental testing/synctest package designed to make testing code that involves time or concurrency precise and fast. I’m pretty excited about it!…

Field Test Mode

I’ve been having a lot of call trouble at home lately using Eastlink and an iPhone 13 mini. Even though I have all the signal bars: Full bars Received and placed calls would fail right away or audio would cut in and out for both sides. I’ve been working with Eastlink support but no breakthroughs yet.

Monitoring convergence

Where possible, I like to build systems around convergence. These systems generally look something like: Tick on some regular interval (10 minutes, 1 hour, etc) Update the view of the world (discover new data, observe a value, etc) Act on the updated view, possibly comparing to the previous view (stop some servers, process newly discovered data, etc) For example, an auto scaling group would…

My Mastodon setup

It seems like Twitter may not be around much longer. Even if does stay around, it’s not likely to be a place I want to be anymore. Like many folks, I decided to dip into the Fediverse . Using Mastodon seemed like a good first step. I set up an account on mastodon.social but quickly realized it was overwhelmed. There were other servers to join but I wanted to run my own. My goals:

macOS DNS resolving change in Go 1.20

Summary Starting in Go 1.20 1 , DNS lookups when running on macOS will be done via the system instead of via Go’s built-in resolver. That’s even when cgo is not available, such as when cross-compiling from Linux. That should reduce surprises for people using tools cross-compiled for macOS from Linux, such as CLIs like terraform and kubectl. It should also make it easier for developers…

Mapping Halifax Traffic Calming Requests

Halifax has a systemic road safety problem. One way it manifests is people driving too fast, especially on residential streets. Recently, Halifax Regional Council mostly approved their 2021 capital budget. It includes $1 million for traffic calming and the final budget may include $1 million more. Read more about that here or here . The city publishes a ranked list of approved requests. Not all…

Injecting errors to test idempotency

As part of Heroku Private Spaces we attach extra Elastic Network Interfaces to instances, and we do that in Go with aws-sdk-go . The process isn’t the most idempotent and we recently discovered we were occasionally leaking ENIs. This could happen if we created an ENI and then encountered an error later in the process, such as when attaching it to an instance. I set out this morning to find a…

Reducing nesting in Go functions with early returns

One of my favorite localized Go refactorings is reducing nesting by using return as early as possible. Take this example, based on a recently-refactored function at Heroku: func example () error { if err := start (); err != nil { existing , err := fetchExisting () if err != nil { return err } if existing . IsWorking () { return nil } else { return errors . New ( 'found existing but it's not…

Using postgression on Travis CI

At Heroku we use Travis CI to run project tests on push to GitHub . While Travis CI offers PostgreSQL in their environment, it’s version 9.1. A project I’m working on recently started using PostgreSQL 9.2’s JSON data type , which 9.1 does not have. Needing 9.2, I searched for ways to make it available in the Travis CI environment. I found guides that suggested upgrading…

Introduction to Ledger

Since July 30th, I’ve been using ledger (on GitHub ) to track my personal finances. What did I use before? I’m ashamed to say nothing beyond my banks’ sites. I stumbled upon ledger via this blog post , linked from Hacker News. It took me a while to try it, for a few reasons. First, I had a weird notion that there would be a better time in my various “fiscal cycles” to…