Fix x509 certificate errors in Go by setting GODEBUG=x509ignoreCN=0 or updating your CA bundle.
Set the GODEBUG environment variable to x509ignoreCN=0 or tls13=0 to bypass strict certificate validation, or ensure your system's CA bundle is up to date. For Go 1.21+, you can also use //go:debug x509ignoreCN=0 in your source code to disable Common Name checking if the certificate is valid but the CN field is missing.
export GODEBUG=x509ignoreCN=0
go build ./...
The "x509: certificate signed by unknown authority" error means your Go program doesn't trust the website it's trying to connect to because the security certificate looks suspicious or is missing a required field. It's like a bouncer at a club refusing entry because your ID doesn't match the name on the guest list. You fix it by telling Go to trust the certificate anyway or by updating your system's list of trusted authorities.