Skip to content

v2.0.0

Compare
Choose a tag to compare
@mroth mroth released this 14 Nov 20:59
· 25 commits to main since this release
0892404

馃帀 weightedrand now utilizes generics for the container data structure to clean up the API and improve end-user ergonomics, thus typecasting is no longer required when obtaining your result, and can utilize any integer type for scores.

This requires a tiny code change if upgrading from a previous version (most likely just removing now unneeded typecasts), and manual upgrading of your import path to include the /v2 (see https://golang.cafe/blog/how-to-upgrade-to-a-major-version-in-go.html).

E.g. what used to be:

result := chooser.Pick().(type)

Can now simply be expressed as:

result := chooser.Pick()

This also means that the current version of the library requires go >= 1.18. For previous versions, you can continue to rely upon v1 of this library. The go module versioning system ensures you will not be automatically upgraded to a new major version without manual action.

What's Changed

  • v2: conversion to utilize go1.18 generics by @mroth in #14

Full Changelog: v1.0.0...v2.0.0