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
+4.9k Golang : Display packages names during compilation
+13.7k Golang : Convert spaces to tabs and back to spaces example
+11.5k Get form post value in Go
+26.7k Golang : Find files by extension
+21.7k Golang : How to reverse slice or array elements order
+6.4k Grep : How to grep for strings inside binary data
+4.7k Fix Google Analytics Redundant Hostnames problem
+9.6k Golang : Find correlation coefficient example
+9.6k Golang : interface - when and where to use examples
+50.7k Golang : Disable security check for HTTPS(SSL) with bad or expired certificate
+15.9k Golang : Get sub string example