var a byte
var b []byte
i know how to do this
c := append(b,a...)
but how do i do this elegantly?
c := append(a,b...) <-- what's the solution does anyone knows?
Would like to have the c[0] == a, c[1:] == b for checking next time
var a byte
var b []byte
i know how to do this
c := append(b,a...)
but how do i do this elegantly?
c := append(a,b...) <-- what's the solution does anyone knows?
Would like to have the c[0] == a, c[1:] == b for checking next time
You can use the bytes.Buffer to make this cleaner:
var a byte
var buf bytes.Buffer
buf.WriteByte(a)// For a single byte
buf.Write([]byte{a})// For byte slice