'Postgres Connection string with multiple hostname in Go

I am trying to connection an application (written in Golang) to postgres DB with multiple hostname. To connect for a single DB hostname we use below syntax,

go:user=test password=****** host=database1.com port=5432 dbname=testing sslmode=disable

For multiple hostname i tried below syntax but from the logs I see the connection string is built only with the first hostname

go:user=test password=****** host=database1.com,database2.com port=5432 dbname=testing sslmode=disable

so I am trying to find a connection string for Golang to connect to multiple postgres hostname. pq is the Go library used as a driver for postgres,so would like to know whether the pq librasy supports multiple hosts.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source