diamondburned's blog
Just a blog

rangefunc in sourcegraph/conc? I sure hope this answers your question.

I tried adding rangefunc into sourcegraph/conc. The answer may or may not shock you!!!

read more

Using lowdb

This article is written for Fullyhacks 2024. It is a guide to using lowdb, a simple JSON database for small projects.

read more

The Fediverse/Meta Drama

If you have an irrational hate for companies and despise Meta, don't read this article! You'll get irrationally mad! You have been warned!

Note: This article is mostly a copy-paste of my Mastodon thread, so it's not really well written. You can follow the thread at https://hachyderm.io/@diamond/110567418571811538.


read more

This article is a reply to @robpike@hachyderm.io's toot.

I'm sorry, but this post screams "boomer take" to me. As much as I am a huge fan of Go and their creators, I don't think this take makes sense. (1/4)

read more

TitanCodes 2023 Walkthrough (spoilers!)

Note: this article contains spoilers!.

I'll be using this article to brain-dump my thought process while doing TitanCodes 2023. A lot of the solutions here assume you already know some Linux and will heavily utilize Linux tools.

read more

Nix Cheat Sheet

This document describes a few useful Nix functionalities that you’ll want to use often.

Note that only use this document to get the gist of things; it is not meant to be a detailed explanation. As usual, heed for the man pages for more information. It is also written with the intention that you're using Nix within a non-NixOS distribution.

read more

Cgo rambling: sacrificing performance or tricking the runtime?

This following comment is extracted from a file in gotk4:

read more

What uses are Go interfaces, and why should I care?

Let's go down a shallow rabbit hole and talk about the importance of interfaces and how it impacts your code not just for unit testing but also to neatly separate and organize your services.

read more

Go's http.Handler is a lot more flexible than some people would expect. Here are some of my preferred ways of using them.

The article will assume that the router library is chi, because it's a great library to use. It will also assume that the application being made is named bookstore.

read more

Profiling in Go is dead easy. You should do it.

read more

Go doesn't have unions, but there's a hack to do it.

Assume we want to create a union type of a node that may be a text node or a container node that holds text nodes. The following code (playground) demonstrates this:

read more

fmt.Scan, fmt.Scanf and fmt.Scanln are harmful.

Every time I want to use those APIs, I always find myself having to look up the documentation for their exact behaviors.

read more

Using Go contexts as "magical value vaults" can be hard to understand. This article is written to quickly introduce a way to easily grasp it.

(This blog article was rewritten from a previous chat message.)

Given this piece of Go code that uses the chi router library:

read more

Image uploader/browser with only Caddy

Making an image uploader and browser server with the cleanest stack ever.

read more