util.go
func resolveSocket(path string) (string, string) {
	dir, dbname := path, ""
	for dir != "" && dir != "/" && dir != "." {
		if m := mode(dir); m&os.ModeSocket != 0 {
			return dir, dbname
		}
		dir, dbname = stdpath.Dir(dir), stdpath.Base(dir)
	}

	return path, ""
}
func resolveSocket(path string) (string, string) {
	dir, dbname := path, ""
	for dir != "" && dir != "/" && dir != "." {
		if m := mode(dir); m&os.ModeSocket != 0 {
			return dir, dbname
		}
		dir, dbname = stdpath.Dir(dir), stdpath.Base(dir)
	}

	return path, ""
}
func resolveSocket ( path string ) ( string , string ) { dir , dbname := path , " " for dir != " " && dir != " " && dir != " " { if m := mode ( dir ) ; m & os . ModeSocket != 0 { return dir , dbname } dir , dbname = stdpath . Dir ( dir ) , stdpath . Base ( dir ) } return path , " " }
// resolveSocket tries to resolve a path to a Unix domain socket based on the
// form "/path/to/socket/dbname" returning either the original path and the
// empty string, or the components "/path/to/socket" and "dbname", when
// /path/to/socket/dbname is reported by os.Stat as a socket.
//
// Used for MySQL DSNs.
resolveSocket tries to resolve a path to a Unix domain socket based on the form / path / to / socket / dbname returning either the original path and the empty string or the components / path / to / socket and dbname when / path / to / socket / dbname is reported by os . Stat as a socket . Used for MySQL DSNs .