Skip to content

Commit

Permalink
JPRO-3315 Cleanup Code Warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-brown-jamf committed Dec 27, 2023
1 parent 36766ea commit b4972f9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import (
/*
Data struct to configure dump behavior
Out: Stream to wite to
Connection: Database connection to dump
IgnoreTables: Mark sensitive tables to ignore
MaxAllowedPacket: Sets the largest packet size to use in backups
LockTables: Lock all tables for the duration of the dump
Out: Stream to wite to
Connection: Database connection to dump
IgnoreTables: Mark sensitive tables to ignore
MaxAllowedPacket: Sets the largest packet size to use in backups
LockTables: Lock all tables for the duration of the dump
*/
type Data struct {
Out io.Writer
Expand Down Expand Up @@ -320,7 +320,7 @@ func (table *table) CreateSQL() (string, error) {
}

if info[0].String != table.Name {
return "", errors.New("Returned table is not the same as requested table")
return "", errors.New("returned table is not the same as requested table")
}

return info[1].String, nil
Expand Down
4 changes: 2 additions & 2 deletions dump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"testing"

sqlmock "github.com/DATA-DOG/go-sqlmock"
"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -186,7 +186,7 @@ func TestCreateSQLWrongTable(t *testing.T) {

result, err := table.CreateSQL()
assert.Error(t, err)
expectedError := errors.New("Returned table is not the same as requested table")
expectedError := errors.New("returned table is not the same as requested table")
assert.Equal(t, expectedError, err)

// we make sure that all expectations were met
Expand Down
10 changes: 5 additions & 5 deletions mysqldump.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ func Dump(db *sql.DB, out io.Writer) error {
// Will also close the database the dumper is connected to as well as the out stream if it has a Close method.
//
// Not required.
func (d *Data) Close() error {
func (data *Data) Close() error {
defer func() {
d.Connection = nil
d.Out = nil
data.Connection = nil
data.Out = nil
}()
if out, ok := d.Out.(io.Closer); ok {
if out, ok := data.Out.(io.Closer); ok {
out.Close()
}
return d.Connection.Close()
return data.Connection.Close()
}

func exists(p string) (bool, os.FileInfo) {
Expand Down

0 comments on commit b4972f9

Please sign in to comment.