Skip to content

Commit 7e9d2c7

Browse files
committed
golangci-lint: enable dupword linter
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 2d61f70 commit 7e9d2c7

10 files changed

Lines changed: 16 additions & 11 deletions

File tree

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ linters:
33
- bodyclose
44
- depguard
55
- dogsled
6+
- dupword # Detects duplicate words.
67
- gocyclo
78
- gofumpt
89
- goimports

cli/command/container/formatter_stats.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const (
2424
pidsHeader = "PIDS" // Used only on Linux
2525
)
2626

27-
// StatsEntry represents represents the statistics data collected from a container
27+
// StatsEntry represents the statistics data collected from a container
2828
type StatsEntry struct {
2929
Container string
3030
Name string

cli/command/defaultcontextstore.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ type EndpointDefaultResolver interface {
4444
// the lack of a default (e.g. because the config file which
4545
// would contain it is missing). If there is no default then
4646
// returns nil, nil, nil.
47+
//
48+
//nolint:dupword // ignore "Duplicate words (nil,) found"
4749
ResolveDefault() (interface{}, *store.EndpointTLSData, error)
4850
}
4951

cli/command/formatter/image_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ image tag2 imageID2 N/A 0B
148148
Format: NewImageFormat("table {{.Repository}}", false, false),
149149
},
150150
},
151-
"REPOSITORY\nimage\nimage\n<none>\n",
151+
"REPOSITORY\nimage\nimage\n<none>\n", //nolint:dupword // ignore "Duplicate words (image) found"
152152
},
153153
{
154154
ImageContext{
@@ -169,7 +169,7 @@ image <none>
169169
Format: NewImageFormat("table {{.Repository}}", true, false),
170170
},
171171
},
172-
"REPOSITORY\nimage\nimage\n<none>\n",
172+
"REPOSITORY\nimage\nimage\n<none>\n", //nolint:dupword // ignore "Duplicate words (image) found"
173173
},
174174
{
175175
ImageContext{
@@ -284,7 +284,7 @@ image_id: imageID3
284284
Format: NewImageFormat("{{.Repository}}", false, false),
285285
},
286286
},
287-
"image\nimage\n<none>\n",
287+
"image\nimage\n<none>\n", //nolint:dupword // ignore "Duplicate words (image) found"
288288
},
289289
{
290290
ImageContext{
@@ -293,7 +293,7 @@ image_id: imageID3
293293
},
294294
Digest: true,
295295
},
296-
"image\nimage\n<none>\n",
296+
"image\nimage\n<none>\n", //nolint:dupword // ignore "Duplicate words (image) found"
297297
},
298298
}
299299

cli/command/formatter/tabwriter/tabwriter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const (
202202
//
203203
// minwidth minimal cell width including any padding
204204
// tabwidth width of tab characters (equivalent number of spaces)
205-
// padding padding added to a cell before computing its width
205+
// padding the padding added to a cell before computing its width
206206
// padchar ASCII char used for padding
207207
// if padchar == '\t', the Writer will assume that the
208208
// width of a '\t' in the formatted output is tabwidth,

cli/command/image/formatter_history_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ func TestHistoryContext_Table(t *testing.T) {
213213
{ID: "imageID6", Created: oldDate, CreatedBy: "/bin/bash echo", Size: int64(182964289), Comment: "Hi", Tags: []string{"image:tag2"}},
214214
}
215215

216+
//nolint:dupword // ignore "Duplicate words (CREATED) found"
216217
const expectedNoTrunc = `IMAGE CREATED CREATED BY SIZE COMMENT
217218
imageID1 24 hours ago /bin/bash ls && npm i && npm run test && karma -c karma.conf.js start && npm start && more commands here && the list goes on 183MB Hi
218219
imageID2 24 hours ago /bin/bash echo 183MB Hi
@@ -221,6 +222,7 @@ imageID4 24 hours ago /bin/bash grep
221222
imageID5 N/A /bin/bash echo 183MB Hi
222223
imageID6 17 years ago /bin/bash echo 183MB Hi
223224
`
225+
//nolint:dupword // ignore "Duplicate words (CREATED) found"
224226
const expectedTrunc = `IMAGE CREATED CREATED BY SIZE COMMENT
225227
imageID1 24 hours ago /bin/bash ls && npm i && npm run test && kar… 183MB Hi
226228
imageID2 24 hours ago /bin/bash echo 183MB Hi

cli/command/service/parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func ParseConfigs(client client.ConfigAPIClient, requestedConfigs []*swarmtypes.
7171
}
7272

7373
// the configRefs map has two purposes: it prevents duplication of config
74-
// target filenames, and it it used to get all configs so we can resolve
74+
// target filenames. It is used to get all configs, so we can resolve
7575
// their IDs. unfortunately, there are other targets for ConfigReferences,
7676
// besides just a File; specifically, the Runtime target, which is used for
7777
// CredentialSpecs. Therefore, we need to have a list of ConfigReferences

cli/command/service/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ func updateCredSpecConfig(flags *pflag.FlagSet, containerSpec *swarm.ContainerSp
13651365
// otherwise, set the credential spec to be the parsed value
13661366
credSpec := credSpecOpt.Value.(*credentialSpecOpt).Value()
13671367

1368-
// if this is a Config credential spec, we we still need to replace the
1368+
// if this is a Config credential spec, we still need to replace the
13691369
// value of credSpec.Config with the config ID instead of Name.
13701370
if credSpec.Config != "" {
13711371
for _, config := range containerSpec.Configs {

cli/command/service/update_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ func TestUpdateGetUpdatedConfigs(t *testing.T) {
10561056
},
10571057
}
10581058
// cannedConfigRefs is the same thing, but with config references instead
1059-
// instead of ID, however, it just maps an arbitrary string value. this is
1059+
// of ID, however, it just maps an arbitrary string value. this is
10601060
// so we could have multiple config refs using the same config
10611061
cannedConfigRefs := map[string]*swarm.ConfigReference{
10621062
"fooRef": {

cli/trust/trust.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ func GetSignableRoles(repo client.Repository, target *client.Target) ([]data.Rol
262262
return signableRoles, nil
263263
}
264264

265-
// there are delegation roles, find every delegation role we have a key for, and
266-
// attempt to sign into into all those roles.
265+
// there are delegation roles, find every delegation role we have a key for,
266+
// and attempt to sign in to all those roles.
267267
for _, delegationRole := range allDelegationRoles {
268268
// We do not support signing any delegation role that isn't a direct child of the targets role.
269269
// Also don't bother checking the keys if we can't add the target

0 commit comments

Comments
 (0)