We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When appending single bytes to []byte, compiler adds extra 0x0 for all values starting from 0x80 up to 0xFF
[]byte
0x0
{ "append bytes bigger than 0x79", `package foo func Main() []byte { var z []byte z = append(z, 0x78, 0x79, 0x80, 0x81, 0xFF) return z }`, []byte{0x78, 0x79, 0x80, 0x81, 0xFF}, }, // Expected :[]byte{0x78, 0x79, 0x80, 0x81, 0xff} // Actual :[]byte{0x78, 0x79, 0x80, 0x0, 0x81, 0x0, 0xff, 0x0}
Appending with z = append(z, []byte{0x78, 0x79, 0x80, 0x81, 0xFF}...) solves the issue.
z = append(z, []byte{0x78, 0x79, 0x80, 0x81, 0xFF}...)
The text was updated successfully, but these errors were encountered:
fyrchik
Successfully merging a pull request may close this issue.
When appending single bytes to
[]byte
, compiler adds extra0x0
for all values starting from 0x80 up to 0xFFAppending with
z = append(z, []byte{0x78, 0x79, 0x80, 0x81, 0xFF}...)
solves the issue.The text was updated successfully, but these errors were encountered: