alecthomas/units

Helpful unit multipliers and functions for Go

131

stars

23

commits

Go

primary language

Aug 19, 2026

updated

README

Go Reference

Units - Helpful unit multipliers and functions for Go

The goal of this package is to have functionality similar to the time package.

It allows for code like this:

n, err := ParseBase2Bytes("1KB")
// n == 1024
n = units.Mebibyte * 512

Contributors

alecthomas

12 commits

costela

2 commits

cben

1 commits

hanjm

1 commits

alecthomas/units

Helpful unit multipliers and functions for Go

131

stars

23

commits

Go

primary language

Aug 19, 2026

updated

README

Go Reference

Units - Helpful unit multipliers and functions for Go

The goal of this package is to have functionality similar to the time package.

It allows for code like this:

n, err := ParseBase2Bytes("1KB")
// n == 1024
n = units.Mebibyte * 512

Contributors

alecthomas

12 commits

costela

2 commits

cben

1 commits

hanjm

1 commits

Languages

Go

100.0%