test code like this:
o := make(map[string]string)
dsn := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable",
"localhost",
5432,
"test",
"",
"testDB",
)
parseOpts(dsn, o)
fmt.Println(o)
output:
map[host:localhost password:dbname=testDB port:5432 sslmode:disable user:test]
in this map, we can see the passwd value is that "dbname=testDB" rather than ""
In this case,it is a wrong dsn parser?
Or when my passwd is null, I can only put passwd end of dsn,like this:
dsn := fmt.Sprintf("host=%s port=%d user=%s dbname=%s sslmode=disable password=%s",
"localhost",
5432,
"test",
"testDB",
"",
)