I want something like
type bye
type kilo uint64 = 1024 * byte
etc …
I want something like
type bye
type kilo uint64 = 1024 * byte
etc …
No, you want multiply a type with a value and is not possible since in Go types are not values. The common practice is to define constants like const Kbyte = 1024
and use them, for instance from stdlib time
package: time.Sleep(3 * time.Second)
where:
type Duration int64
const (
Nanosecond Duration = 1
Microsecond = 1000 * Nanosecond
Millisecond = 1000 * Microsecond
Second = 1000 * Millisecond
Minute = 60 * Second
Hour = 60 * Minute
)
This is exactly what I was looking for. Thank you!