Skip to content

Commit b173bb5

Browse files
committed
Fixed some linting errors
1 parent 975af48 commit b173bb5

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

driver/connector.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import (
99

1010
// Config is a struct that holds non-credential database configuration.
1111
type Config struct {
12+
Opts map[string]string
13+
Formatter Formatter
1214
Host string
13-
Port int
1415
DB string
15-
Opts map[string]string
16+
Port int
1617
Retries int
17-
Formatter Formatter
1818
}
1919

2020
var (
@@ -108,7 +108,14 @@ func (c *Connector) Connect(ctx context.Context) (driver.Conn, error) {
108108
return nil, err
109109
}
110110

111-
connStr = c.formatter(creds.GetUsername(), creds.GetPassword(), c.cfg.Host, c.cfg.Port, c.cfg.DB, c.cfg.Opts)
111+
connStr = c.formatter(
112+
creds.GetUsername(),
113+
creds.GetPassword(),
114+
c.cfg.Host,
115+
c.cfg.Port,
116+
c.cfg.DB,
117+
c.cfg.Opts,
118+
)
112119

113120
conn, err = c.driver.Open(connStr)
114121
if err == nil {

store/vault/credentials/agent_database_test.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"io/ioutil"
87
"os"
98
"strings"
109
"testing"
@@ -30,7 +29,7 @@ var testMapper Mapper = func(s string) (*store.Credential, error) {
3029
}
3130

3231
func TestNewAgentDatabaseCredentials(t *testing.T) {
33-
tmpfile, err := ioutil.TempFile("", "")
32+
tmpfile, err := os.CreateTemp("", "")
3433
if err != nil {
3534
t.Fatal(err)
3635
}
@@ -62,11 +61,19 @@ func TestNewAgentDatabaseCredentials(t *testing.T) {
6261
}
6362

6463
if mappedCreds.GetUsername() != username {
65-
t.Fatalf("expected username to be '%s' but got '%s' instead", username, mappedCreds.GetUsername())
64+
t.Fatalf(
65+
"expected username to be '%s' but got '%s' instead",
66+
username,
67+
mappedCreds.GetUsername(),
68+
)
6669
}
6770

6871
if mappedCreds.GetPassword() != password {
69-
t.Fatalf("expected password to be '%s' but got '%s' instead", password, mappedCreds.GetPassword())
72+
t.Fatalf(
73+
"expected password to be '%s' but got '%s' instead",
74+
password,
75+
mappedCreds.GetPassword(),
76+
)
7077
}
7178
}
7279

@@ -82,7 +89,7 @@ func TestNewAgentDatabaseCredentialsFailedFileRead(t *testing.T) {
8289
}
8390

8491
func TestNewAgentDatabaseCredentialsFailedMapper(t *testing.T) {
85-
tmpfile, err := ioutil.TempFile("", "")
92+
tmpfile, err := os.CreateTemp("", "")
8693
if err != nil {
8794
t.Fatal(err)
8895
}

0 commit comments

Comments
 (0)