-
Amusing to find myself being roped into a release ofโฆ something, that needs to go out this week. Not entirely sure what needs to go out, and I don’t think anyone else does either. But damnit, it must be released by Friday!
-
Found this gem of a remark in the documentation of Go’s time formatting string:
It is a regrettable historic error that the date uses the American convention of putting the numerical month before the day.
Yeah, kind of wish we learnt from history on this one. ๐ผ
-
TTL that h2c, the Go HTTP handler that allows for unencrypted HTTP/2 connections, does not do graceful shutdowns. When you call
http.Shutdown()on a server using this hijacking handler, instead of draining the active request, it just kills the server. The good news is that it’s now deprecated in favour of http.Protocols, which doesn’t have this problem. -
๐ Blain Smith: Just Fucking Use Go
There are not enough “this"es in the English language I can add in support for this post.
-
Might be time to take another look at Zed. Got Go properly setup in it and used it to fix a small bug. I have to do something about the font, but it feels pretty featureful compared to the last time I looked. Shows some decent promise.
-
A gentle reminder that just because you have a coding agent, doesn’t mean everything needs to go through the coding agent. If something can achieved using a traditional command invocation, just use that. It’ll burn zero tokens and would end up being faster in the long run.
-
Could Swift's Guard Statement Work in Go?
Exploring the idea of a
guardstatement in Go reveals significant challenges and limitations compared to its implementation in Swift. Spoilers: it probably wouldn’t work. Continue reading โ -
๐ Devlog
Imagen
A personal playground with image generation models (not related to Google’s Imagen model). Continue reading โ
-
๐ ๏ธ Sky โ an Elm-inspired language that compiles to Go
Kind of striking seeing Go becoming the target of other languages. Here’s another one. Looks a bit like Haskell to my eyes.
Via: Hacker News
-
๐ ๏ธ Lisette โ Rust syntax, Go runtime
A little language inspired by Rust that compiles to Go
This looks really interesting.
-
It looks like Go’s getting a UUID package added to the standard library. Someone’s been reading my mind, or at the very least reading my blog. ๐
-
My Coolify instance has been running really slowly over the last few days. I may start looking at alternatives, or maybe go back to using Dokku.
-
Go iterators don’t have a built in way to send errors back, so I borrowed something from Haskell and made a “maybe” type:
type Maybe[T any] { Value T Err error } func (m Maybe[T]) Get() (T, error) { return m.Value, m.Err }The iterator pushes values wrapped in this, which would have
Valueset if one is available, orErrset if not. TheGet()method provides a convenient way to get both, allowing for patterns that look much like the following:func consume() error { for m := range myIter() { val, err := m.Get() if err != nil { return err } } doThingWithVal(val) } -
Had a go (heh) at making a Go iterator. It was simpler than I expected, once I got my head around how they work. It’s a push model, the iterator pushes value to a yield function, which sends it to
range, and receives a flag on whether to continue. The package docs do a good job explaining this. -
A bit frustrating that I asked my IDE to rename all instances of a method, and it did around half of them, ignoring the interfaces the type implements. I know Go interfaces are different to Java interfaces, but if the type checker passes already, rename things such that it remains that way.
-
Reason Go should add enums number 5,132: you’re not left up to runtime checks to verify that an enum value is invalid. You can rely on the type system to do that. It’s all well and good to implement marshallers and unmarshallers that verify that the input is a valid enum value, but that doesn’t stop developers from casting any arbitrary string to your enum type. And then what are you expected to do in your String() method (which doesn’t return an error)? Do you panic? Return “invalid?” Return the string enum value as is, even if it is invalid?
Making it impossible to even produce invalid types is the whole reason why we have a type system. It’s why I prefer Go over an untyped language like Python and JavaScript. So it would be nice if Go supported enums in the type system to get this guarantee.
-
Added my ๐ to the other 192 on this Go proposal to add generics to methods. Great idea! I’ve been wishing for this for a while.
-
It’s so satisfying seeing the run of a large Go test suite reveal itself as a tree when executed in an editor. IDEs should lean into this, allowing execution of subtests to any depth (not just the top + 1 level), and offering features like find.
-
๐ Devlog
An API For a Keyframe Animation Package
A Go-based key-frame animator for Ebitengine projects was developed, emphasizing a clear API for animating float values with room for future enhancements. Continue reading โ
-
Achievement unlocked: setting up a CI/CD pipeline the builds a Go WASM project and deploys it to Netlify that worked first try.
-
๐ Devlog
Blogging Tools - Image Collections Triage App
Using Google Antigravity to add an improved image triaging feature for Blogging Tools, allowing the user to categorise images from posts and automate header image updates. Continue reading โ
-
Kind of crazy seeing Go packages which are effectively WASM builds of C libraries running in a Go WASM runtime, like this sqlite3 port. So that’s WASM sandwiched between two layers of Go. A “WASM smash burger,” if you will. Still, if you want to avoid using Cgo, then I can understand the motivation.
-
Interesting development in the world of Go: in 1.26, the new() function will now accept expressions, not just types. This returns a pointer to the value, which will be useful for those types that use pointers for their fields:
type User struct { Age *int } user := User{} var age int = 10 user.Age = new(age)It also works for literal values, so that temporary
agevariable is strictly not necessary, although the linked post does state that it requires some consideration for types. Havinguser.Age = new(10)will work without issue asnewwill return a*int; but ifAgewere a*uint, you’ll get a type error.I go on about unnecessary pointer types in the past (and will probably continue to do so in the future). To me, it’s just one of those paper-cuts you encounter in your day to day that you know can be made easier. So I consider this a welcome change. It’s not going to same me a ton on code, but every little bit helps.
-
Learning To Like Sentinel Errors In Go
Coming around to returning a result or an error in the Go programming instead of returning nil for both. Continue reading โ
-
๐ Devlog
Dequoter โ Something Different Today
A new project called Dequoter was started to unquote a JSON string and filter it, utilizing Go for backend functionality and HTML for the frontend. Continue reading โ