Skip to content

Commit 06bfcd6

Browse files
committed
Enable dupword linter
Signed-off-by: Maksym Pavlenko <[email protected]>
1 parent c5c636b commit 06bfcd6

14 files changed

Lines changed: 17 additions & 12 deletions

File tree

.golangci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ linters:
1313
- unconvert
1414
- unused
1515
- vet
16+
- dupword # Checks for duplicate words in the source code
1617
disable:
1718
- errcheck
1819

@@ -34,7 +35,7 @@ linters-settings:
3435
# The following issues surfaced when `gosec` linter
3536
# was enabled. They are temporarily excluded to unblock
3637
# the existing workflow, but still to be addressed by
37-
# by future works.
38+
# future works.
3839
excludes:
3940
- G204
4041
- G305

cio/io_unix_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func TestLogURIGenerator(t *testing.T) {
240240
{
241241
scheme: "binary",
242242
path: "C:\\path\\to\\binary",
243-
// NOTE: Windows paths should not be be parse-able outside of Windows:
243+
// NOTE: Windows paths should not be parse-able outside of Windows:
244244
err: "must be absolute",
245245
},
246246
})

cmd/containerd-stress/density.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ type Stat struct {
204204
}
205205

206206
func parseStat(data string) (stat Stat, err error) {
207+
//nolint:dupword
207208
// From proc(5), field 2 could contain space and is inside `(` and `)`.
208209
// The following is an example:
209210
// 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

content/local/store.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ func (s *store) resumeStatus(ref string, total int64, digester digest.Digester)
505505
return status, fmt.Errorf("provided total differs from status: %v != %v", total, status.Total)
506506
}
507507

508+
//nolint:dupword
508509
// TODO(stevvooe): slow slow slow!!, send to goroutine or use resumable hashes
509510
fp, err := os.Open(data)
510511
if err != nil {

errdefs/grpc_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func TestGRPCRoundTrip(t *testing.T) {
4242
input: ErrNotFound,
4343
cause: ErrNotFound,
4444
},
45+
//nolint:dupword
4546
{
4647
input: fmt.Errorf("test test test: %w", ErrFailedPrecondition),
4748
cause: ErrFailedPrecondition,

images/converter/default.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func copyDesc(desc ocispec.Descriptor) *ocispec.Descriptor {
132132
return &descCopy
133133
}
134134

135-
// convertLayer converts image image layers if c.layerConvertFunc is set.
135+
// convertLayer converts image layers if c.layerConvertFunc is set.
136136
//
137137
// c.layerConvertFunc can be nil, e.g., for converting Docker media types to OCI ones.
138138
func (c *defaultConverter) convertLayer(ctx context.Context, cs content.Store, desc ocispec.Descriptor) (*ocispec.Descriptor, error) {

metadata/db.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ func (m *DB) RegisterMutationCallback(fn func(bool)) {
283283
// RegisterCollectibleResource registers a resource type which can be
284284
// referenced by metadata resources and garbage collected.
285285
// Collectible Resources are useful ephemeral resources which need to
286-
// to be tracked by go away after reboot or process restart.
286+
// be tracked by go away after reboot or process restart.
287287
//
288288
// A few limitations to consider:
289289
// - Collectible Resources cannot reference other resources.

pkg/cap/cap_linux_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/stretchr/testify/assert"
2525
)
2626

27+
//nolint:dupword
2728
const procPIDStatus = `Name: cat
2829
Umask: 0022
2930
State: R (running)

pkg/cri/sbserver/container_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ func (c *criService) runtimeSpec(id string, baseSpecFile string, opts ...oci.Spe
366366
}
367367

368368
// Overrides the default snapshotter if Snapshotter is set for this runtime.
369-
// See See https://github.com/containerd/containerd/issues/6657
369+
// See https://github.com/containerd/containerd/issues/6657
370370
func (c *criService) runtimeSnapshotter(ctx context.Context, ociRuntime criconfig.Runtime) string {
371371
if ociRuntime.Snapshotter == "" {
372372
return c.config.ContainerdConfig.Snapshotter

pkg/cri/sbserver/instrumented_service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ func (in *instrumentedService) UpdateRuntimeConfig(ctx context.Context, r *runti
15371537
if err != nil {
15381538
log.G(ctx).WithError(err).Error("UpdateRuntimeConfig failed")
15391539
} else {
1540-
log.G(ctx).Debug("UpdateRuntimeConfig returns returns successfully")
1540+
log.G(ctx).Debug("UpdateRuntimeConfig returns successfully")
15411541
}
15421542
}()
15431543
res, err = in.c.UpdateRuntimeConfig(ctrdutil.WithNamespace(ctx), r)
@@ -1553,7 +1553,7 @@ func (in *instrumentedAlphaService) UpdateRuntimeConfig(ctx context.Context, r *
15531553
if err != nil {
15541554
log.G(ctx).WithError(err).Error("UpdateRuntimeConfig failed")
15551555
} else {
1556-
log.G(ctx).Debug("UpdateRuntimeConfig returns returns successfully")
1556+
log.G(ctx).Debug("UpdateRuntimeConfig returns successfully")
15571557
}
15581558
}()
15591559
// converts request and response for earlier CRI version to call and get response from the current version

0 commit comments

Comments
 (0)