Generics in Golang 1.18, no need to write max / min anymore (maybe)

Jerome Wu
ITNEXT
Published in
2 min readJun 8, 2021

--

One thing I do dislike in golang is that sometimes a simple task can be very tedious. One of them is getting maximum / minimum value of two integers.

Background

The root cause of the tediousness of this task is the lack of generics in golang which means you can not implement a max/min function which accepts both…

--

--

Writer for

A technology enthusiast wishes to make the world better and better. Maintainer of tesseract.js and ffmpeg.wasm