Skip to content

Commit

Permalink
Merge pull request #7911 from mxpv/dupword
Browse files Browse the repository at this point in the history
Enable dupword linter
  • Loading branch information
AkihiroSuda committed Jan 3, 2023
2 parents f15563c + 06bfcd6 commit c6aa1db
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ linters:
- unconvert
- unused
- vet
- dupword # Checks for duplicate words in the source code
disable:
- errcheck

Expand All @@ -34,7 +35,7 @@ linters-settings:
# The following issues surfaced when `gosec` linter
# was enabled. They are temporarily excluded to unblock
# the existing workflow, but still to be addressed by
# by future works.
# future works.
excludes:
- G204
- G305
Expand Down
2 changes: 1 addition & 1 deletion cio/io_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func TestLogURIGenerator(t *testing.T) {
{
scheme: "binary",
path: "C:\\path\\to\\binary",
// NOTE: Windows paths should not be be parse-able outside of Windows:
// NOTE: Windows paths should not be parse-able outside of Windows:
err: "must be absolute",
},
})
Expand Down
1 change: 1 addition & 0 deletions cmd/containerd-stress/density.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ type Stat struct {
}

func parseStat(data string) (stat Stat, err error) {
//nolint:dupword
// From proc(5), field 2 could contain space and is inside `(` and `)`.
// The following is an example:
// 89653 (gunicorn: maste) S 89630 89653 89653 0 -1 4194560 29689 28896 0 3 146 32 76 19 20 0 1 0 2971844 52965376 3920 18446744073709551615 1 1 0 0 0 0 0 16781312 137447943 0 0 0 17 1 0 0 0 0 0 0 0 0 0 0 0 0 0
Expand Down
1 change: 1 addition & 0 deletions content/local/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ func (s *store) resumeStatus(ref string, total int64, digester digest.Digester)
return status, fmt.Errorf("provided total differs from status: %v != %v", total, status.Total)
}

//nolint:dupword
// TODO(stevvooe): slow slow slow!!, send to goroutine or use resumable hashes
fp, err := os.Open(data)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions errdefs/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func TestGRPCRoundTrip(t *testing.T) {
input: ErrNotFound,
cause: ErrNotFound,
},
//nolint:dupword
{
input: fmt.Errorf("test test test: %w", ErrFailedPrecondition),
cause: ErrFailedPrecondition,
Expand Down
2 changes: 1 addition & 1 deletion images/converter/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func copyDesc(desc ocispec.Descriptor) *ocispec.Descriptor {
return &descCopy
}

// convertLayer converts image image layers if c.layerConvertFunc is set.
// convertLayer converts image layers if c.layerConvertFunc is set.
//
// c.layerConvertFunc can be nil, e.g., for converting Docker media types to OCI ones.
func (c *defaultConverter) convertLayer(ctx context.Context, cs content.Store, desc ocispec.Descriptor) (*ocispec.Descriptor, error) {
Expand Down
2 changes: 1 addition & 1 deletion metadata/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func (m *DB) RegisterMutationCallback(fn func(bool)) {
// RegisterCollectibleResource registers a resource type which can be
// referenced by metadata resources and garbage collected.
// Collectible Resources are useful ephemeral resources which need to
// to be tracked by go away after reboot or process restart.
// be tracked by go away after reboot or process restart.
//
// A few limitations to consider:
// - Collectible Resources cannot reference other resources.
Expand Down
1 change: 1 addition & 0 deletions pkg/cap/cap_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/stretchr/testify/assert"
)

//nolint:dupword
const procPIDStatus = `Name: cat
Umask: 0022
State: R (running)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cri/sbserver/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func (c *criService) runtimeSpec(id string, baseSpecFile string, opts ...oci.Spe
}

// Overrides the default snapshotter if Snapshotter is set for this runtime.
// See See https://github.com/containerd/containerd/issues/6657
// See https://github.com/containerd/containerd/issues/6657
func (c *criService) runtimeSnapshotter(ctx context.Context, ociRuntime criconfig.Runtime) string {
if ociRuntime.Snapshotter == "" {
return c.config.ContainerdConfig.Snapshotter
Expand Down
4 changes: 2 additions & 2 deletions pkg/cri/sbserver/instrumented_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ func (in *instrumentedService) UpdateRuntimeConfig(ctx context.Context, r *runti
if err != nil {
log.G(ctx).WithError(err).Error("UpdateRuntimeConfig failed")
} else {
log.G(ctx).Debug("UpdateRuntimeConfig returns returns successfully")
log.G(ctx).Debug("UpdateRuntimeConfig returns successfully")
}
}()
res, err = in.c.UpdateRuntimeConfig(ctrdutil.WithNamespace(ctx), r)
Expand All @@ -1553,7 +1553,7 @@ func (in *instrumentedAlphaService) UpdateRuntimeConfig(ctx context.Context, r *
if err != nil {
log.G(ctx).WithError(err).Error("UpdateRuntimeConfig failed")
} else {
log.G(ctx).Debug("UpdateRuntimeConfig returns returns successfully")
log.G(ctx).Debug("UpdateRuntimeConfig returns successfully")
}
}()
// converts request and response for earlier CRI version to call and get response from the current version
Expand Down
2 changes: 1 addition & 1 deletion pkg/cri/sbserver/podsandbox/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func (c *Controller) runtimeSpec(id string, baseSpecFile string, opts ...oci.Spe
}

// Overrides the default snapshotter if Snapshotter is set for this runtime.
// See See https://github.com/containerd/containerd/issues/6657
// See https://github.com/containerd/containerd/issues/6657
func (c *Controller) runtimeSnapshotter(ctx context.Context, ociRuntime criconfig.Runtime) string {
if ociRuntime.Snapshotter == "" {
return c.config.ContainerdConfig.Snapshotter
Expand Down
2 changes: 1 addition & 1 deletion pkg/cri/server/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func (c *criService) runtimeSpec(id string, baseSpecFile string, opts ...oci.Spe
}

// Overrides the default snapshotter if Snapshotter is set for this runtime.
// See See https://github.com/containerd/containerd/issues/6657
// See https://github.com/containerd/containerd/issues/6657
func (c *criService) runtimeSnapshotter(ctx context.Context, ociRuntime criconfig.Runtime) string {
if ociRuntime.Snapshotter == "" {
return c.config.ContainerdConfig.Snapshotter
Expand Down
4 changes: 2 additions & 2 deletions pkg/cri/server/instrumented_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ func (in *instrumentedService) UpdateRuntimeConfig(ctx context.Context, r *runti
if err != nil {
log.G(ctx).WithError(err).Error("UpdateRuntimeConfig failed")
} else {
log.G(ctx).Debug("UpdateRuntimeConfig returns returns successfully")
log.G(ctx).Debug("UpdateRuntimeConfig returns successfully")
}
}()
res, err = in.c.UpdateRuntimeConfig(ctrdutil.WithNamespace(ctx), r)
Expand All @@ -1553,7 +1553,7 @@ func (in *instrumentedAlphaService) UpdateRuntimeConfig(ctx context.Context, r *
if err != nil {
log.G(ctx).WithError(err).Error("UpdateRuntimeConfig failed")
} else {
log.G(ctx).Debug("UpdateRuntimeConfig returns returns successfully")
log.G(ctx).Debug("UpdateRuntimeConfig returns successfully")
}
}()
// converts request and response for earlier CRI version to call and get response from the current version
Expand Down
2 changes: 1 addition & 1 deletion reference/docker/normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func splitDockerDomain(name string) (domain, remainder string) {
}

// familiarizeName returns a shortened version of the name familiar
// to to the Docker UI. Familiar names have the default domain
// to the Docker UI. Familiar names have the default domain
// "docker.io" and "library/" repository prefix removed.
// For example, "docker.io/library/redis" will have the familiar
// name "redis" and "docker.io/dmcgowan/myapp" will be "dmcgowan/myapp".
Expand Down

0 comments on commit c6aa1db

Please sign in to comment.