Trying Out Generics in Go

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. gostdx

    Extended library functions using generics in Go.

    I too was playing around with Go generics. I wrote some naive concurrent filter and fold (reduce) functions for slices and maps here https://github.com/unix1/gostdx if anyone is curious how those would feel.

  2. CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  3. errcheck

    errcheck checks that you checked errors.

    I'd be really happy with that! Building the functionality of errcheck[1] and ineffassign[2] into the compiler — or at the very least, into govet — would go a long way to allay my worries with Go.

    I think the reason they don't do this is that it's a slight (albeit a very tiny one) against Go's philosophy of errors being values, just like any other. While the `error` type is standard and used throughout Go source code, it still just has a simple three-line definition[3] and is not treated as a special case anywhere else; there is nothing stopping you from returning your own error type if you wish. A third-party linter could simply check for the `error` type specifically, but the first-party tools should not, and there's nothing like Rust's `#[must_use]` attribute that could be used instead. I respect Go's philosophy, but I feel like pragmatism must win in this case.

    [1]: https://github.com/kisielk/errcheck

  4. ineffassign

    Detect ineffectual assignments in Go code.

  5. fut

    I feel the similar way, though I wouldn't be so brave to say I didn't ever use interface{}. I think we all work around slices and maps being the only generic containers and don't know we do. I think everyone will find that while they didn't need generics, they will help them when using utility libraries. Java 1.4 people thought the same.

    I expect a well-curated libraries to come about that will really simplify some otherwise difficult problems for people (e.g. task/object pooling). I'm even toying with a futures impl at https://github.com/cretz/fut, but I wouldn't use it in place of channels in most cases.

  6. go

    The Go programming language

    There's a proposal for the Go 2 draft that addresses this:

    https://github.com/golang/go/issues/20803

    https://go.googlesource.com/proposal/+/master/design/go2draf...

  7. aboriginal

    Aboriginal Generics: the future is here!

  8. reason

    Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems

    I found this closed-mindedness hard to understand -- I don't spend very much conscious thought on the syntax when programming at all -- but for people like you facebook made Reason ML https://reasonml.github.io/

    Someone should port OCaml to the Go runtime with a good high-level FFI. It could really give the community a boost.

  9. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Linter for explicit hint to interface which gets implemented.

    2 projects | /r/golang | 26 Jan 2023
  • Any advice to improve gopls/nvim-lsp performance for a large monorepo?

    3 projects | /r/neovim | 8 Mar 2021
  • Microsoft Go 1.24 FIPS changes

    3 projects | news.ycombinator.com | 6 Feb 2025
  • Go proposal: sync/v2: new package

    1 project | news.ycombinator.com | 5 Feb 2025
  • Go Supply Chain Attack: Malicious Package Exploits Go Module Proxy Caching

    1 project | news.ycombinator.com | 5 Feb 2025

Did you know that Go is
the 4th most popular programming language
based on number of references?