I think I’m having a similar issue with the golang sample. Using the Unix socket results in auth failure and I need to use the first party cloud SQL connector: https://github.com/GoogleCloudPlatform/golang-samples/blob/main/cloudsql/mysql/database-sql/connect_connector.go
In the past Unix socket connections have worked but within the last three or so months it seems to have stopped working.
A work around I found is to login to the DB manually using either the cloud shell or the sql auth proxy https://cloud.google.com/sql/docs/mysql/connect-auth-proxy And then redeploy the app and it seems to connect then.