Tags » golang
TIL: Using Go to write to a file, but only if it doesn’t exist yet
Opening a file with
os.O_CREATE|os.O_EXCL
will ensure you only create the file if it doesn’t already exist.TIL: Repeatedly run flaky Go tests with
stress
It runs your test hundreds of times, which can be useful for finding flaky failures.
TIL: How to list the tests that will be run by a
go test
commandUse
go test -list={pattern}
.TIL: You can change the size of tabs on web pages with the
tab-size
propertyTIL: Go’s compiler is smart enough to spot division by zero errors
TIL: Parsing JSON in Go with a required field
Finding SNS topics without any subscriptions
I’m trying out Go, and I wrote a tool to help me find SNS topics that don’t have any subscriptions.