Golang : dial tcp: too many colons in address
Encounter this error message Golang : dial tcp: too many colons in address ssl://smtp.googlemail.com:465
while working on the transaction email portion today.
After some debugging, found out that Go doesn't like anything more than 1 colon in a string for hostname and password
To fix the problem, just close the string with brackets.
from
smtpHost := "ssl://smtp.googlemail.com"
to
smtpHost := "[ssl://smtp.googlemail.com]"
Basically, when dealing with hostname, password, and dial function. The rule of thumb is
[user:pass@hostname]:portnum
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+8.3k Golang : ISO8601 Duration Parser example
+3.9k Golang : Display advertisement images or strings on random order
+5.9k Golang : Find relative luminance or color brightness
+19.4k Golang : Setting up/configure AWS credentials with official aws-sdk-go
+4.3k Golang : List all packages and search for certain package
+11.2k Golang : Fix cannot use buffer (type bytes.Buffer) as type io.Writer(Write method has pointer receiver) error
+41.8k Golang : Disable security check for HTTPS(SSL) with bad or expired certificate
+9.6k CodeIgniter : How to check if a session exist in PHP?
+5.1k Fix sudo yum hang problem with no output or error messages
+16.2k Golang : Check if os.Stdin input data is piped or from terminal
+7.6k Golang : Validate IPv6 example
+4.6k Golang : Process non-XML/JSON formatted ASCII text file example