Categories
golang Mariadb

Go mysql config

I found that when using mysql.Config, I need to add AllowNativePasswords: true for a connection to mariadb from my go program

 30 cfg := mysql.Config{
 31         User: os.Getenv("DBUSER"),
 32         Passwd: os.Getenv("DBPASS"),
 33         Net: "tcp",
 34         Addr: "172.18.0.6:3306",
 35         AllowNativePasswords: true,
 36         DBName: "recordings",
 37     }
 ...
 42 db, err = sql.Open("mysql",cfg.FormatDSN())

Categories
golang

golang dependencies

when I build a module locally, I need to adjust the location in the calling modules go.mod file using the local directory structure relative to the calling modules location. example below:

$ go mod edit -replace=example.com/theirmodule@v0.0.0-unpublished=../theirmodule
$ go get -d example.com/theirmodule@v0.0.0-unpublished

More info here…

/https://go.dev/doc/modules/managing-dependencies#naming_module