Standard library / encoding/hex
encoding/hex.Dump()
Returns a human-readable hex dump with offsets and printable characters, not a pure hex encoding. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func Dump(data []byte) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| data | []byte | Input bytes for XML, or fixed-size value / destination pointer for binary operations. |
Return Value
string
Text representation.
Working Example
Example Snippetgo
package main
import ( "encoding/hex" "fmt" "strings")
func must(e error) { if e != nil { panic(e) }}
func main() { fmt.Println(strings.Contains(hex.Dump([]byte("Go")), "47 6f")) }