func Open(gormConfig gorm.Config) (db *gorm.DB, err error) {
// get database route information through environment variables
var values []string
values, err = config.ReadMany("DB_HOST", "DB_USER", "DB_PASSWORD", "DB_NAME")
// get dsn
dsn := fmt.Sprintf("host=%w user=%w password=%w dbname=%w", values...) // <- COMPILE ERROR HERE
// open database
return gorm.Open(postgres.Open(dsn), &gormConfig)
}
I'm getting a compile error at values..., its giving me "Cannot use 'values' (type []string) as the type []any".
Is there any way to work around to this, can I convert var values []string to var values []any or the other way around?"
Thanks