A Handy Way to Generate Self-Signed Certificates in Go

When writing an HTTP server in Go, you might need a self-signed certificate. Here's a useful one-liner for that:

This will generate cert.pem and key.pem files.

While I used to rely on tools like OpenSSL or mkcert, this approach seems sufficient if you're already using Go.

cf. Source file src/crypto/tls/generate_cert.go