I am having trouble compiling code Google-Cloud offers on connecting to a mysql database remotely using Golang.
The code is a direct copy-paste from here: https://cloud.google.com/sql/docs/mysql/connect-external-app#go
. One may also look here: https://github.com/GoogleCloudPlatform/cloudsql-proxy/blob/master/proxy/dialers/mysql/hook_test.go
.
I've tried providing a second variable to the first line below, but there is an error as only one value is returned by the mysql function.
The troublesome code is on the second line, possibly due to the first line.
cfg := mysql.Cfg("haveibeenexploited:us-west1:hibe", "username", "password")
cfg.DBName := "mythril"
db, err := mysql.DialCfg(cfg)
searchcontract/searchcontract.go:67:5: non-name cfg.DBName on left side of :=
is the error message I get.