使用binary.Read()将字节流解码为结构时,是否可以为每个字段指定大/小尾数?

When decoding bytes, binary.Read() requires you to specify the expected byte order of that operation. binary.Read() also allows you to pass in a struct, but AFAIK, it uses the same byte order to decode the byte stream into every field in the struct.

This is inconvenient when the byte order of encoded integers is in little endian but encoded strings and floats are in big endian.

Is it possible to specify on a per-field basis, which byte-order to use when decoding a stream of bytes into a struct?

No, it doesn't look like it.

The Read method goes through all of the work of deciphering what it needs to read .. then all of the actual read methods have this:

d.order.....

So basically, they use the ByteOrder you've specified directly .. and make no attempt (via struct tags or anything else) to let you specify it on a per-field basis.

Unfortunate .. but I smell an opportunity for someone to come along and make a neat package that can be shared with the community :)