Full Width [alt+shift+f] Shortcuts [alt+shift+k]
Sign Up [alt+shift+s] Log In [alt+shift+l]
48

Type parameters in Go

from Blog - Bitfield Consulting [alt+shift+b] in programming

Now that generics have come to Go, let's take a look at the new syntax for type parameters. We’ll find out why we need type parameters, how we write them, and how we can use them to create generic functions in Go.
10th Mar 2024

Stay updated

Get a weekly newsletter with the top 5 articles worth reading every week.

More from Blog - Bitfield Consulting

Bobcoin, blockchains, and cryptocurrency

How do cryptocurrencies actually work, though? Join Alice and Bob as they embark on designing a new digital ledger for secure “Bobcoin” transactions.

12th Apr 2025 • 54 votes
Catching grace

Meditation is easy when you know what to do: absolutely nothing! It's hard at first, like trying to look at the back of your own head, but there's a knack to it.

12th Mar 2025 • 66 votes
Writing terrible code

The secret of being a great coder is to write terrible code. Wait, wait. Hear me out: I’m going somewhere with this.

27th Feb 2025 • 66 votes
The magic function

How do you design user-friendly APIs in Rust? The answer is simple: you use them! Let’s build a simple Rust CLI tool using what I call the “magic function” approach.

3rd Jan 2025 • 93 votes
Suite smells: undertesting and overtesting

Tests are great, provided they actually test something. But are your tests too optimistic (assuming the code already works), or too persnickety (testing the irrelevant)?

8th Dec 2024 • 116 votes

More in programming

We solved SQLite's single-writer limitation

Multiple concurrent writers. Multiple processes. Same SQLite. No modifications.

an hour ago • 1 votes
SumatraPDF new features: April 4, 2026

New in the SumatraPDF pre-release builds: Bake PDF File New Bake PDF File command (CmdPdfBake) in the Ctrl + k command palette turns interactive form fields and annotations into static page content and saves the result as a new PDF, which then opens. Show PDF Outline New Show PDF Outline command (CmdShowPdfOutline) in the command palette shows the document’s outline (table of contents) as text in a window. Tab Groups menu Saving and restoring tab groups now has its own Tab Groups submenu (in the Favorites menu) with Save Tab Group and Restore Tab Group. Both are also in the tab right-click menu. There is also a window for managing saved groups (#4402). Screenshots include open menus Take Screenshot also captures open menus as separate windows you can pick. Menu bar improvements with tabs The custom menu bar shown when tabs are in the title bar works more like a normal menu bar, and toggling the menu bar is more reliable (#5442, #549). More: changes from April 4, 2026 and the full changelog.

12 hours ago • 1 votes
If your team is happy, are you doing a good job?

Brilliant jerks, ZIRP-era managers, and how psychological safety lost the plot. Part 3 of my conversation with Dr. Cat Hicks.

18 hours ago • 1 votes
WTF is context engineering? (with real examples)

Say you're deploying an AI assistant that processes online order returns. For it to work, it would need access to your store's purchase policy, item…

2 days ago • 1 votes
Hosting without hyperscalers
3 days ago • 1 votes
📚 BoredReading

You seem to be enjoying this.

Join free to unlock everything.

Create free account

Already have an account? Sign in