Go standard library Go
A Go snippet for Go standard library that answers requests for /pixel.gif with the empty GIF, decoded once at startup.
Go standard library Go
package main
import (
"encoding/base64"
"log"
"os"
)
func main() {
gif, err := base64.StdEncoding.DecodeString("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")
if err != nil {
log.Fatal(err)
}
if err := os.WriteFile("pixel.gif", gif, 0o644); err != nil {
log.Fatal(err)
}
}
We ran this snippet and compared the bytes it returned.
Official site: Go standard library