Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion database/testing/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ func TestDrop(t *testing.T, d database.Driver) {
}

func TestSetVersion(t *testing.T, d database.Driver) {
// nolint:maligned
testCases := []struct {
name string
version int
Expand Down
5 changes: 3 additions & 2 deletions database/yugabytedb/yugabytedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,9 @@ func (c *YugabyteDB) doTxWithRetry(
}

// If we've tried to commit the transaction Rollback just returns sql.ErrTxDone.
//nolint:errcheck
defer tx.Rollback()
defer func() {
_ = tx.Rollback()
}()

if err := fn(tx); err != nil {
if errIsRetryable(err) {
Expand Down
5 changes: 0 additions & 5 deletions migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1339,11 +1339,6 @@ func newMigSeq(migr ...*Migration) migrationSequence {
return migr
}

func (m *migrationSequence) add(migr ...*Migration) migrationSequence { // nolint:unused
*m = append(*m, migr...)
return *m
}

func (m *migrationSequence) bodySequence() []string {
r := make([]string, 0)
for _, v := range *m {
Expand Down
21 changes: 10 additions & 11 deletions testing/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (d *DockerContainer) Logs() (io.ReadCloser, error) {
})
}

func (d *DockerContainer) portMapping(selectFirst bool, cPort int) (containerPort uint, hostIP string, hostPort uint, err error) { // nolint:unparam
func (d *DockerContainer) portMapping(selectFirst bool, cPort int) (hostIP string, hostPort uint, err error) {
if !d.containerInspected {
if err := d.Inspect(); err != nil {
d.t.Fatal(err)
Expand All @@ -212,29 +212,28 @@ func (d *DockerContainer) portMapping(selectFirst bool, cPort int) (containerPor
// Skip ahead until we find the port we want
continue
}
for _, binding := range bindings {

if len(bindings) > 0 {
binding := bindings[0]
hostPortUint, err := strconv.ParseUint(binding.HostPort, 10, 64)
if err != nil {
return 0, "", 0, err
return "", 0, err
}

return uint(port.Int()), binding.HostIP, uint(hostPortUint), nil // nolint: staticcheck
return bindings[0].HostIP, uint(hostPortUint), nil
}
}

if selectFirst {
return 0, "", 0, errors.New("no port binding")
return "", 0, errors.New("no port binding")
} else {
return 0, "", 0, errors.New("specified port not bound")
return "", 0, errors.New("specified port not bound")
}
}

func (d *DockerContainer) Host() string {
if d == nil {
panic("Cannot get host for a nil *DockerContainer")
}
_, hostIP, _, err := d.portMapping(true, -1)
hostIP, _, err := d.portMapping(true, -1)
if err != nil {
d.t.Fatal(err)
}
Expand All @@ -250,7 +249,7 @@ func (d *DockerContainer) Port() uint {
if d == nil {
panic("Cannot get port for a nil *DockerContainer")
}
_, _, port, err := d.portMapping(true, -1)
_, port, err := d.portMapping(true, -1)
if err != nil {
d.t.Fatal(err)
}
Expand All @@ -261,7 +260,7 @@ func (d *DockerContainer) PortFor(cPort int) uint {
if d == nil {
panic("Cannot get port for a nil *DockerContainer")
}
_, _, port, err := d.portMapping(false, cPort)
_, port, err := d.portMapping(false, cPort)
if err != nil {
d.t.Fatal(err)
}
Expand Down
Loading