Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(lint): enable misspell and gci linters #1162

Merged
merged 2 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
args: --timeout=3m
args: --verbose

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
Expand Down
13 changes: 13 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
linters:
enable:
- gci
- gofmt
- misspell


linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/testcontainters)

run:
timeout: 3m
1 change: 0 additions & 1 deletion container.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/pkg/archive"
"github.com/docker/go-connections/nat"

tcexec "github.com/testcontainers/testcontainers-go/exec"
"github.com/testcontainers/testcontainers-go/internal/testcontainersdocker"
"github.com/testcontainers/testcontainers-go/wait"
Expand Down
1 change: 0 additions & 1 deletion container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"time"

"github.com/stretchr/testify/assert"

"github.com/testcontainers/testcontainers-go/wait"
)

Expand Down
4 changes: 1 addition & 3 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ import (
"sync"
"time"

"github.com/docker/docker/api/types/filters"

"github.com/cenkalti/backoff/v4"
"github.com/containerd/containerd/platforms"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
Expand All @@ -32,7 +31,6 @@ import (
"github.com/google/uuid"
"github.com/moby/term"
specs "github.com/opencontainers/image-spec/specs-go/v1"

tcexec "github.com/testcontainers/testcontainers-go/exec"
"github.com/testcontainers/testcontainers-go/internal"
"github.com/testcontainers/testcontainers-go/internal/testcontainersdocker"
Expand Down
2 changes: 1 addition & 1 deletion docker_mounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type DockerBindMountSource struct {
*mount.BindOptions

// HostPath is the path mounted into the container
// the same host path might be mounted to multiple locations withing a single container
// the same host path might be mounted to multiple locations within a single container
HostPath string
}

Expand Down
15 changes: 5 additions & 10 deletions docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"context"
"errors"
"fmt"
"log"

"io"
"log"
"math/rand"
"net/http"
"os"
Expand All @@ -16,19 +15,15 @@ import (
"testing"
"time"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/strslice"
"github.com/docker/docker/api/types/volume"
"github.com/docker/docker/errdefs"
"github.com/docker/go-units"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/docker/docker/errdefs"

"github.com/docker/docker/api/types/volume"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"

"github.com/testcontainers/testcontainers-go/internal/testcontainersdocker"
"github.com/testcontainers/testcontainers-go/wait"
)
Expand Down
1 change: 0 additions & 1 deletion generic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"testing"

"github.com/stretchr/testify/require"

"github.com/testcontainers/testcontainers-go/wait"
)

Expand Down
4 changes: 1 addition & 3 deletions logconsumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ import (
"testing"
"time"

"github.com/docker/docker/client"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/docker/docker/client"

"github.com/testcontainers/testcontainers-go/internal/testcontainersdocker"
"github.com/testcontainers/testcontainers-go/wait"
)
Expand Down
2 changes: 1 addition & 1 deletion mounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type ContainerMountSource interface {
// Optionally mount.BindOptions might be added for advanced scenarios
type GenericBindMountSource struct {
// HostPath is the path mounted into the container
// the same host path might be mounted to multiple locations withing a single container
// the same host path might be mounted to multiple locations within a single container
HostPath string
}

Expand Down
3 changes: 1 addition & 2 deletions network.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package testcontainers
import (
"context"

"github.com/docker/docker/api/types/network"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/network"
)

// NetworkProvider allows the creation of networks on an arbitrary system
Expand Down
1 change: 0 additions & 1 deletion network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/docker/docker/api/types/network"
"github.com/stretchr/testify/assert"

"github.com/testcontainers/testcontainers-go/wait"
)

Expand Down
1 change: 0 additions & 1 deletion reaper.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/docker/docker/api/types/container"
"github.com/docker/go-connections/nat"

"github.com/testcontainers/testcontainers-go/internal"
"github.com/testcontainers/testcontainers-go/internal/testcontainersdocker"
"github.com/testcontainers/testcontainers-go/wait"
Expand Down
1 change: 0 additions & 1 deletion wait/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/go-connections/nat"

"github.com/testcontainers/testcontainers-go"
tcexec "github.com/testcontainers/testcontainers-go/exec"
"github.com/testcontainers/testcontainers-go/wait"
Expand Down
2 changes: 1 addition & 1 deletion wait/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestWaitForHealthSucceeds(t *testing.T) {
assert.Nil(t, err)
}

// TestWaitForHealthWithNil checks that an initial `nil` Health will not casue a panic,
// TestWaitForHealthWithNil checks that an initial `nil` Health will not cause a panic,
// and if the container eventually becomes healthy, the HealthStrategy will succeed.
func TestWaitForHealthWithNil(t *testing.T) {
target := &healthStrategyTarget{
Expand Down