Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My golang wishlist:

1. A error return syntax like =? In rust.

2. Sum types

3. Pattern matching

There is a lot of boilerplate but I've found libraries like Uber/fx help a TON.

Also I've been doing a lot of codegen using a library that can parse a package and return an ast API whose name escapes me right now...

Overall I think the language is in a great place with generics added



sum types are my number one. the frustrating part is that it almost has it with type sets in interfaces, which you can use in function signatures, but you can't use them in definitions of other types.

example, given an interface that is scoped to 4 types:

    type PlayingCardSuit interface {
      Diamond | Spade | Heart | Club
    }
I can use that in a function signature:

    func PrintCardSuit(c PlayingCardSuit) {
     ...
    }
But i can't use it to compose other types:

    type PlayingCard struct {
     Suit PlayingCardSuit // error
     Rank string
    }




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: