progressbar icon indicating copy to clipboard operation
progressbar copied to clipboard

feat!: use generics for new progressbar creation

Open hexnaught opened this issue 3 years ago • 0 comments

Changes to allow either int or int64 when calling various 'New' methods to create new progressbar instances.

items := make([]int, 999)
bar1 := progressbar.Default(len(items))
bar2 := progressbar.Default(int64(len(items)))

This is a breaking change as it requires Go v1.18 to make use of generics. May be worth stating this in the README above the installation title on v4 release.

## Requires

Progressbar V4 requires Go version v1.18 or later.

Note: Can't make methods generics (i.e. those bound to structs, ChangeMax, ChangeMax64 etc) due to limitations in current generics implementation with Go.

Resolves schollz/progressbar#129

hexnaught avatar Aug 11 '22 09:08 hexnaught