package main
import (
"encoding/base64"
"fmt"
)
func main() {
str := base64.StdEncoding.EncodeToString([]byte("nilpointer.net"))
fmt.Println("Encode:", str)
data, err := base64.StdEncoding.DecodeString(str)
if err != nil {
fmt.Println("Error:", err)
}
fmt.Println("Decode:", string(data))
}
Output
Encode: bmlscG9pbnRlci5uZXQ=
Decode: nilpointer.net