func generateNewKey(name string) error {
	key, err := securecookie.GenerateRandomKey()
	if err != nil {
		return err
	}
	os.Remove(name)
	f, err := os.OpenFile(name, os.O_CREATE|os.O_WRONLY, 0600)
	if err != nil {
		return err
	}
	if _, err = f.Write(key); err != nil {
		return err
	}
	f.Close()
	return nil
}
Full web server example setting and retrieving a cookie named "myCookie".
Save the main.go file in some directory, and add a go.mod file by invoking the
command "go mod init example.com". Run the server with the command "go run main.go".
With your browser, request url "http://localhost:8080/set/someValue"
to assign the value "someValue" to the secure cookie named "myCookie" sent to the browser.
To retrieve the cookie, request url "http://localhost:8080/val".
The key to secure the cookie will be saved in the file named "key.dat" in the current directory.
generateNewKey generates and save new key in file with name name.
package main
import (
	"fmt"
	"html"
	"log"
	"net/http"
	"os"
	"strings"
	"github.com/chmike/securecookie"
)