SoFunction
Updated on 2025-03-01

Go language base64 usage example

This article describes the usage of base64 in the go language. Share it for your reference. The details are as follows:

Here is a small example of golang base64, the code is as follows:

Copy the codeThe code is as follows:
package main
import (
    "fmt"
    "encoding/base64"
)
           
func main() {
    b64 := ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
println(([]byte("haha")))
}

Found a better solution:

Copy the codeThe code is as follows:
package main
import (
    "fmt"
    "encoding/base64"
)
func main() {
    s := []byte("/pkg/encoding/base64/#variables")
    ("%s\n", (s))
}

I hope this article will be helpful to everyone's Go language programming.