Forgotten import?

I get the error:

2019/03/02 11:23:33 sql: unknown driver “postgres” (forgotten import?)
exit status 1

on the code

db, err := sql.Open(“postgres”, os.Getenv(“ELEPHANTSQL_URL”))

“database/sql” - is in the imports,
do I need to use some other import?

Yes, you have forgotten to import the postgresql driver.

something like this

import _ "package/name/of/driver/for/postgres"
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.