I am writing a small program to check the endianness using Go: var i int = 0x0100 ptr := unsafe.Pointer(&i) if 0x01 == *(*byte)(ptr) { fmt.Println("Big Endian") } else if 0x00 == *(*byte)(ptr) { fmt.Println("Little Endian") } else { // ... } I import "unsafe" package to convert *int to *byte. But as mentioned in https://golang.org/pkg/unsafe/: Package unsafe contains operations that step around th