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
+5.1k Golang : Debug with Godebug
+4.8k Unix/Linux : How to open tar.gz file ?
+8.2k Golang : Temperatures conversion example
+5.8k Golang : Get expvar(export variables) to work with multiplexer
+6.3k Golang : Create zip/ePub file without compression(use Store algorithm)
+8.2k Golang : Scramble and unscramble text message by randomly replacing words
+4.8k Javascript : How to replace HTML inside <div>?
+11.9k Golang : List objects in AWS S3 bucket
+6.9k Golang : How to feed or take banana with Gorilla Web Toolkit Session package
+10.4k Get form post value in Go
+5.4k WARNING: UNPROTECTED PRIVATE KEY FILE! error message
+17.1k Golang : Logging with logrus