Just to note, for this specific example, Go supports this with type definitions:
// UserID and PostID are distinct types
type UserID int
type PostID int // UserID and PostID are distinct types
type UserID int
type PostID intIt still provides a documentation benefit of course.
EDIT: Whoops, yes, as lentil points out, they are indeed distinct types not aliases. So it does provide the benefit of the Rust solution.
Your playground example didn't try to pass a UserID to a function accepting a PostID, but if you do that, you'll see the error:
I think the generic approach is a little bit better because of the flexibility, but this approach is still better than not having it at all.