Has anyone got an idea if there is any inbuilt functionality in Go for converting from any one of the numeric types to its binary number form.
For example, if
Unsafe pointers must be used to correctly represent negative numbers in binary format.
package main
import (
"fmt"
"strconv"
"unsafe"
)
func bInt(n int64) string {
return strconv.FormatUint(*(*uint64)(unsafe.Pointer(&n)), 2)
}
func main() {
fmt.Println(bInt(-1))
}
https://play.golang.org/p/GxXjjWMyC4x