-
π οΈ 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 β
-
π GitHub: Gopher Hawaiian Shirts
Patterns for printing Hawaiian shirts with the Go gopher. I think I’ve found what I’ll be wearing to work in the future. π
Via: Golang Weekly
-
Dear Go developers,
You don’t need to return pointers,
Unless you do need to return pointers.
But if you think you need to return pointers,
You probably don’t need to return pointers.Instead, consider just returning regular struct values. Keep the nil-pointer panics at bay.
-
The
exhaustiveGo linter complaining about missing cases for switch statements with adefaultclause is killing me.missing cases in switch of type this, and this, and this, and this, andβ¦
-
Request for a go linter: something that would warn when an variable with the name
erris not of typeerror:func Bla() { err := 123 // 'err' not of type 'error' }Would’ve saved me a few hours today trying to test if a Future was not-nil, without actually waiting for the result.
-
Moan-routine: LO's Predicate Signatures
A critique of function signatures the ’lo’ package offers for functions like Map and Filter. Continue reading β
-
Does Google ever regret naming Go “Go”? Such a common word to use as a proper noun. I know the language devs prefer not to use Golang, but there’s no denying that it’s easier to search for.
-
Broadtail
Date: 2021 β 2022
Status: Paused
First project I’ll talk about is Broadtail. I think I talked about this one before, or at least I posted screenshot of it. I started work on this in 2021. The pandemic was still raging, and much of my downtime was watching YouTube videos. We were coming up to a federal election, and I was getting frustrated with seeing YouTube ads from political parties that offend me. This was before YouTube Premium so there was no real way to avoid these ads. Or was there?
Continue reading β -
Why I like developing in Go vs. something like NodeJS: my development setup doesn’t randomly break for some weird reason. When it does break, it’s because of something I did explicitly.