I am new to Go and functional paradigm. while working with database connections in golang I have to import
mysql driver. And I came across "_" which is to mention blank identifier for variables and import packages which are soley for their side effects.
Searched for side-effects and found this side effects in es6
What I didn't understand is side effect of a function is dependent on a global variable which deviates the referential transparency of a pure function. But how does a package can bring side effect? Is it because the dependency on the package as side effect?
eg:
import _ "github.com/go-sql-driver/mysql"
db, err := sql.Open("mysql", "user:password@/dbname")
Here the import has "_" because Open
statement is dependent on driver name?