将整数放在缓冲区中,并用零填充左垫?

I'm trying to implement a protocol and currently have problems with this step:

The big-endian binary representation of the sequence number SHALL be placed in a 16-octet buffer and padded (on the left) with zeros.

The sequence number is an int.

I think the correct way to create the 16-octet buffer is like this:

buf := make([]byte, 16)

However, I'm not sure how to place the sequence number in the buffer so it follows the requirements above?

It sounds like you want something like this:

func seqToBuffer(seq int) []byte {
    buf := make([]byte, 16)
    for i := len(buf) - 1; seq != 0; i-- {
        buf[i] = byte(seq & 0xff)
        seq >>= 8
    }
    return buf
}