Im trying to make a simple functionality that will run migrations for me, but now i cant call a method from a normal function and thats giving me a lot of trouble, since the functions are being called all over the file if i add the interface to each one of the functions i would have to add the interface to like 10 function ( also doesnt seem reasonable ). Are any better way i could solve it?
type MigrationBridge struct {
store Storage
}
func readMigrationFile(cmd string) {
filename, err := getMigrationsLastFile()
filename = "./gosql/migrations/" + filename
if err != nil {
fmt.Println(FmtRed("Error trying to GET the migration file"), err)
return
}
data, err := os.ReadFile(filename)
if err != nil {
fmt.Println(FmtRed("Error trying to READ the migration file"), err)
return
}
dat := string(data)
fileByLines := getFileByLines(dat)
if err := validateFileLines(fileByLines); err != nil {
fmt.Println(err)
return
}
<------------ PROBLEM -------------->
runMigration(fileByLines, cmd)
}