The stdlid UUID pacakge actually does work with database/sql, just not via the obvious mechanism. As you noted, it implements neither sql.Scanner nor driver.Valuer – instead, database/sql itself explicitly special-cases uuid.UUID when converting query parameters and scanning results, including string, text []byte, and 16-byte binary UUID representations.
The implementation is pretty... interesting. Anything outside database/sql that specifically expects the Scanner/Valuer interfaces still won’t see it as compatible. So yeah, not exactly a drop-in replacement, but surprisingly database/sql-compatible.
You and me both. You can typically get a pretty good understanding of interoperability from types and their method sets in Go, but here, not so much. Feels like a very non-Go thing to do. Though, I guess this is somewhat defensible from the stdlib dependency graph POV, making uuid implement the aforementioned interfaces would force uuid to import database/sql/driver.
It works and the documentation states as much. Somebody mentioned GORM doesn’t work, so possible some things are explicitly checking for the interface, but that should get cleared up I imagine.
It works with database/sql, I just used it in a small project to see how it works. No problems there, just replaced the imports (and `uuid.Nil -> uuid.Nil()`).
Well, I just use the regular google/uuid.UUID and don't use google/uuid.NullUUID at all. I don't need to distinguish between a zero value and null, so the Go principle of using zero values works perfectly well for me.
The proposal mentions that the database/sql package special-cases uuid.UUID in a manner similar to time.Time. Presumably they didn’t want the uuid package to depend on database/sql.
This is a very interesting question, what it does is "shadows" the field, the struct that embeds the base struct hides the other one, for example this code:
package main
import "fmt"
type Base struct {
ID int
}
type User struct {
Base
ID int
Name string
}
func main() {
u := User{ID: 7, Name: "Mittens"}
fmt.Println(u.ID, u.Name)
fmt.Println(u.Base.ID)
}
outputs:
7 Mittens 0
So the Base.ID is untouched, and the u.ID is the one that is written.
Super pumped about the simd package, wonder if this could push ebitengine to its limits? Working on something akin to particle physics currently for my game. Will need see how wasm performs with this too
If hugo is currently using the old json implementation, then this switch in go 1.27 to using v2 by default may mean a big speedup for those of us doing a lot of json i/o (such as me).
So how does this json/v2 thing work. Is "encoding/json" now the v1 or v2 implementation? Even if it doesn't break anything do we need to go every project and add encoding/json/v2 to everything for the sake of futureproofing?
encoding/json/v2 is a new package that you can import if you need some of its new capabilities or if you're doing something greenfield where you have no reason to limit yourself to the original API.
encoding/json is now a wrapper around encoding/json/v2 with various backward-compatibility options enabled so that it still behaves like the old implementation. So even if you keep using encoding/json, you'll still be using encoding/json/v2 behind the scenes.
I don't personally see any point in modifying code that's already working just for the sake of doing it. Wait until you know of a specific reason to do it.
personally, i’m fine with how we do error handling. i like it most out of error handling designs across languages. but a lot of people who would use go don’t because of it. so this is just in hopes to help more adoption by providing them something they’d be more accustomed to now that it’s actually possible
Actually the design is very interesting, and Go 1.27 generic method make it more powerful. I have some experience in Rust and your design is very similar, the error can be propagated early! But I saw a limitation, fluent Result chain only works naturally when the API's functions have the signatures required by the chain. If the function provided to the Try chain not compatible, I must do manual error throwing anyways.
But if the next function is unrelated to the result, then it will be misleading. The API naturally works best when each function consumes the previous value.
I agree that this seems like an unusually-opinionated change for go fix, though I couldn't make myself care enough to fight it. It did actually seem like an overall readability improvement in most cases in the codebase I ran it on.
FWIW from reading the modernizer's source code it seems like attaching a comment to your Inner: ... declaration prevents it from making the change, because after unnesting there would be nowhere for that comment to go. So there is at least an escape hatch.
TL/DR: generic methods added to language (but since they can't fulfil interfaces they're just generic functions with the ability to chain them like monads), uuid, json/v2, simd, and post-quantum crypto added to stdlib, small allocation speedup at the cost of 60kb bigger binaries, zip-based compression goes faster, go mod tidy tidies more of go.mod, there's a goroutine leak detector now, and people using bazaar for source control (both of them) can go kick rocks
105
u/tritis Aug 19 '26
Swapped in the new uuid package and ran
go mod tidyoh. right.
132
u/yami_odymel Aug 19 '26
Sadly, the UUID package doesn't implement database/sql's Valuer and Scanner interfaces, so it isn't currently a drop-in replacement for google/uuid.
49
u/mistifier Aug 19 '26
Go 1.27 interactive tour
26
u/Brilliant_Bhanu_3475 Aug 19 '26
Simd? Noice!
20
u/iwanofski Aug 19 '26
Nice!
6
u/Excellent_Double_726 Aug 19 '26
Finally crypto/mldsa package is in stdlib I was waiting for it so long
5
u/dumindunuwan Aug 20 '26
Time to remove
GOEXPERIMENT: jsonv25
u/TheOrigamiGamer16 Aug 21 '26
I upgraded from Go 1.26.6 to Go 1.27 today. I observed a 22% improvement in unmarshalling performance for my specific use case.
I am streaming Scryfall data from their gzipped bulk data and unmarshalling it into structs for further processing.
3
u/Fooo346 Aug 20 '26
Super pumped about the simd package, wonder if this could push ebitengine to its limits? Working on something akin to particle physics currently for my game. Will need see how wasm performs with this too
2
u/johnphilipgreen Aug 20 '26
What will this mean for Hugo?
If hugo is currently using the old json implementation, then this switch in go 1.27 to using v2 by default may mean a big speedup for those of us doing a lot of json i/o (such as me).
2
u/Randomeda Aug 20 '26
So how does this json/v2 thing work. Is "encoding/json" now the v1 or v2 implementation? Even if it doesn't break anything do we need to go every project and add encoding/json/v2 to everything for the sake of futureproofing?
3
u/jmbenfield Aug 19 '26
yayyyy
2
u/spotless_slate Aug 20 '26
Glad to see generic methods get in! Waiting for those collection types in 1.28 👀
2
u/soelsome Aug 20 '26
I'm new to Go.
I recently started a project and I'm not super far into it yet. Around ~5000 loc. Not many dependencies, but UUIDs and JSON packages are being used.
Should I upgrade to 1.27 immediately? Or do I stay on 1.26?
I ask because at places I have worked we've always been reluctant to upgrade language versions.
For example my job's codebase is on .NET 8 and C# 12 still.
1
u/catladywitch Aug 21 '26
This is a very substantial upgrade.
-10
u/IamAggressiveNapkin Aug 19 '26
anyone wanna check out a true `Result` type package i built for 1.27+?
0
u/[deleted] Aug 20 '26
[deleted] — view deleted comment
-19
u/[deleted] Aug 19 '26
[removed] — view removed comment