Standard library / go/constant
go/constant.Bytes()
Encode the integer magnitude as little-endian bytes, without the sign. Expected stdout: '[2 1]\n'.
Formal Syntax & Structure
go syntaxgo
func Bytes(x Value) []byteParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | Value | Input constant or Go value as specified by the function. |
Return Value
[]byte
Encode the integer magnitude as little-endian bytes, without the sign.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/constant")
func main() { fmt.Println(constant.Bytes(constant.MakeInt64(-258))) }