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.7k Linux : Disable and enable IPv4 forwarding
+26.3k Golang : Move file to another directory
+20.9k Golang : Repeat a character by multiple of x factor
+12k Golang : Generate Code128 barcode
+7k Golang : Variadic function arguments sanity check example
+5.8k Mac OSX : Find large files by size
+13.5k Golang : How to check if IP address is in range
+5k Golang : Missing Subversion command
+12k Swift : Convert (cast) Int to String ?
+13.3k Golang : Submit web forms without browser by http.PostForm example
+18.1k Golang : Example for DSA(Digital Signature Algorithm) package functions
+20.4k Golang : Match strings by wildcard patterns with filepath.Match() function