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
+12.1k Swift : Convert (cast) Int to String ?
+17.2k Golang : How to get hour, minute, second from time?
+18.2k Golang : Delete item from slice based on index/key position
+7.1k Golang : Get final or effective URL with Request.URL example
+8.5k Golang : Get all countries currencies code in JSON format
+7.7k Golang : Sort lines of text example
+13.7k Golang : Search folders for file recursively with wildcard support
+5.8k Unix/Linux : How to fix CentOS yum duplicate glibc or device-mapper-libs dependency error?
+3.8k Golang : How to pass data between controllers with JSON Web Token
+5.6k Nginx : Password protect a directory/folder
+16.5k How to enable MariaDB/MySQL logs ?