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
+7.3k Golang : Set horizontal, vertical scroll bars policies and disable interaction on Qt image
+17.6k Golang : Login and logout a user after password verification and redirect example
+9.4k Golang : Validate IPv6 example
+6k Golang : Process non-XML/JSON formatted ASCII text file example
+11.4k Golang : Fuzzy string search or approximate string matching example
+13.8k Golang : Reverse IP address for reverse DNS lookup example
+25.5k Golang : missing Mercurial command
+7.6k Golang : Get today's weekday name and calculate target day distance example
+7.2k Golang : Hue, Saturation and Value(HSV) with OpenCV example
+8.4k Golang : Another camera capture GUI application with GTK and OpenCV
+10k Golang : Random Rune generator
+9.4k Golang : Copy map(hash table) example