Standard library / encoding/base32

encoding/base32.Encoding.AppendEncode()

Append encoded bytes to the existing destination prefix and return the extended slice. Available in Go 1.22 and later. Expected stdout: 'id:I5XQ====\n'.

Formal Syntax & Structure

go syntaxgo
func (enc *Encoding) AppendEncode(dst, src []byte) []byte

Parameters & Attributes

NameTypeDescription
dst[]byteDestination byte slice; provide enough capacity for the operation or use an append API.
src[]byteInput bytes in the format expected by the operation.

Return Value

[]byte

Encoded or extended byte slice.

Working Example

Example Snippetgo
package main
import (  "encoding/base32"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() {  v := base32.StdEncoding.AppendEncode([]byte("id:"), []byte("Go"))  fmt.Println(string(v))}
Go Reference