Standard library / encoding/base32

encoding/base32.Encoding.Encode()

Encode the complete input into a preallocated destination of EncodedLen bytes. Do not encode arbitrary stream chunks independently with padding. Expected stdout: 'I5XQ====\n'.

Formal Syntax & Structure

go syntaxgo
func (enc *Encoding) Encode(dst, src []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.

Working Example

Example Snippetgo
package main
import (  "encoding/base32"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() {  e := base32.StdEncoding  src := []byte("Go")  dst := make([]byte, e.EncodedLen(len(src)))  e.Encode(dst, src)  fmt.Println(string(dst))}
Go Reference