Fix the 'http: server gave HTTP response to HTTPS client' error by setting GODEBUG=http2client=0 to disable HTTP/2.
The error occurs because your Go HTTP client is attempting to use HTTP/2 over an unencrypted connection, which the server rejects. Set the GODEBUG environment variable to http2client=0 to force the client to use HTTP/1.1.
export GODEBUG=http2client=0
Alternatively, run your command with the variable prefixed:
GODEBUG=http2client=0 go run main.go
The "http: server gave HTTP response to HTTPS client" error means your program tried to use a fast, modern web protocol (HTTP/2) on a connection that doesn't support it or is unencrypted. Setting this flag tells your program to fall back to the older, universally compatible HTTP/1.1 protocol. It is like forcing a car to use a standard road instead of trying to drive on a highway that requires a special pass.