Skip to content

Instantly share code, notes, and snippets.

@l-vitaly
Created February 26, 2017 11:16
Show Gist options
  • Save l-vitaly/15c71c028c0d08275ade392ee5f77602 to your computer and use it in GitHub Desktop.
Save l-vitaly/15c71c028c0d08275ade392ee5f77602 to your computer and use it in GitHub Desktop.
type ByteSize float64
const (
  _ = iota // ignore first value by assigning to blank identifier
  KB ByteSize = 1 << (10 * iota) // 1 << (10*1)
  MB // 1 << (10*2)
  GB // 1 << (10*3)
  TB // 1 << (10*4)
  PB // 1 << (10*5)
  EB // 1 << (10*6)
  ZB // 1 << (10*7)
  YB // 1 << (10*8)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment