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.6k Golang : A program that contain another program and executes it during run-time
+4.9k Swift : Convert (cast) Float to Int or Int32 value
+7.1k Golang : Not able to grep log.Println() output
+6.8k Golang : Levenshtein distance example
+10.7k Golang : Replace a parameter's value inside a configuration file example
+6.7k Golang : Gargish-English language translator
+45.7k Golang : Read tab delimited file with encoding/csv package
+8.1k Your page has meta tags in the body instead of the head
+11k Golang : Intercept and process UNIX signals example
+5.9k Linux/Unix : Commands that you need to be careful about
+16.2k Golang : Execute terminal command to remote machine example