mirror of
https://github.com/jkaninda/mysql-bkup.git
synced 2025-12-06 13:39:41 +01:00
ci: add go lint
This commit is contained in:
@@ -27,6 +27,7 @@ package pkg
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/jkaninda/encryptor"
|
||||
"github.com/jkaninda/go-storage/pkg/local"
|
||||
@@ -388,7 +389,7 @@ func listDatabases(db dbConfig) ([]string, error) {
|
||||
databases := []string{}
|
||||
// Create the mysql client config file
|
||||
if err := createMysqlClientConfigFile(db); err != nil {
|
||||
return databases, fmt.Errorf(err.Error())
|
||||
return databases, errors.New(err.Error())
|
||||
}
|
||||
utils.Info("Listing databases...")
|
||||
// Step 1: List all databases
|
||||
|
||||
@@ -26,6 +26,7 @@ package pkg
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
goutils "github.com/jkaninda/go-utils"
|
||||
"github.com/jkaninda/mysql-bkup/utils"
|
||||
@@ -70,14 +71,13 @@ func deleteTemp() {
|
||||
func testDatabaseConnection(db *dbConfig) error {
|
||||
// Create the mysql client config file
|
||||
if err := createMysqlClientConfigFile(*db); err != nil {
|
||||
return fmt.Errorf(err.Error())
|
||||
return errors.New(err.Error())
|
||||
}
|
||||
utils.Info("Connecting to %s database ...", db.dbName)
|
||||
// Set database name for notification error
|
||||
utils.DatabaseName = db.dbName
|
||||
|
||||
// Prepare the command to test the database connection
|
||||
//cmd := exec.Command("mariadb", "-h", db.dbHost, "-P", db.dbPort, "-u", db.dbUserName, db.dbName, "-e", "quit")
|
||||
cmd := exec.Command("mariadb", fmt.Sprintf("--defaults-file=%s", mysqlClientConfig), db.dbName, "-e", "quit")
|
||||
// Capture the output
|
||||
var out bytes.Buffer
|
||||
|
||||
Reference in New Issue
Block a user