golang 类型转换

例如将 []byte 类型的变量 IPBody 转换为字符串,直接使用 string(IPBody) 即可。

题外话

byte 类型 和 uint8 是一样的。

The Go Programming Language Specification
Numeric types
uint8       the set of all unsigned  8-bit integers (0 to 255)
byte        alias for uint8
1
2
3
4

reference