diff --git a/.golangci.yml b/.golangci.yml index 7eef20b8cb..4b97b1d118 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,6 +3,7 @@ linters: - bodyclose - depguard - dogsled + - dupword # Detects duplicate words. - gocyclo - gofumpt - goimports diff --git a/cli/command/container/formatter_stats.go b/cli/command/container/formatter_stats.go index 5b46fe2650..dafcb4303b 100644 --- a/cli/command/container/formatter_stats.go +++ b/cli/command/container/formatter_stats.go @@ -24,7 +24,7 @@ const ( pidsHeader = "PIDS" // Used only on Linux ) -// StatsEntry represents represents the statistics data collected from a container +// StatsEntry represents the statistics data collected from a container type StatsEntry struct { Container string Name string diff --git a/cli/command/defaultcontextstore.go b/cli/command/defaultcontextstore.go index 203900e2fc..3e136a174c 100644 --- a/cli/command/defaultcontextstore.go +++ b/cli/command/defaultcontextstore.go @@ -44,6 +44,8 @@ type EndpointDefaultResolver interface { // the lack of a default (e.g. because the config file which // would contain it is missing). If there is no default then // returns nil, nil, nil. + // + //nolint:dupword // ignore "Duplicate words (nil,) found" ResolveDefault() (interface{}, *store.EndpointTLSData, error) } diff --git a/cli/command/formatter/image_test.go b/cli/command/formatter/image_test.go index 36a17f147f..d2388fd6c9 100644 --- a/cli/command/formatter/image_test.go +++ b/cli/command/formatter/image_test.go @@ -148,7 +148,7 @@ image tag2 imageID2 N/A 0B Format: NewImageFormat("table {{.Repository}}", false, false), }, }, - "REPOSITORY\nimage\nimage\n\n", + "REPOSITORY\nimage\nimage\n\n", //nolint:dupword // ignore "Duplicate words (image) found" }, { ImageContext{ @@ -169,7 +169,7 @@ image Format: NewImageFormat("table {{.Repository}}", true, false), }, }, - "REPOSITORY\nimage\nimage\n\n", + "REPOSITORY\nimage\nimage\n\n", //nolint:dupword // ignore "Duplicate words (image) found" }, { ImageContext{ @@ -284,7 +284,7 @@ image_id: imageID3 Format: NewImageFormat("{{.Repository}}", false, false), }, }, - "image\nimage\n\n", + "image\nimage\n\n", //nolint:dupword // ignore "Duplicate words (image) found" }, { ImageContext{ @@ -293,7 +293,7 @@ image_id: imageID3 }, Digest: true, }, - "image\nimage\n\n", + "image\nimage\n\n", //nolint:dupword // ignore "Duplicate words (image) found" }, } diff --git a/cli/command/formatter/tabwriter/tabwriter.go b/cli/command/formatter/tabwriter/tabwriter.go index 079be60c83..fac1b96c58 100644 --- a/cli/command/formatter/tabwriter/tabwriter.go +++ b/cli/command/formatter/tabwriter/tabwriter.go @@ -202,7 +202,7 @@ const ( // // minwidth minimal cell width including any padding // tabwidth width of tab characters (equivalent number of spaces) -// padding padding added to a cell before computing its width +// padding the padding added to a cell before computing its width // padchar ASCII char used for padding // if padchar == '\t', the Writer will assume that the // width of a '\t' in the formatted output is tabwidth, diff --git a/cli/command/image/formatter_history_test.go b/cli/command/image/formatter_history_test.go index 0a8e367a86..b85aac43aa 100644 --- a/cli/command/image/formatter_history_test.go +++ b/cli/command/image/formatter_history_test.go @@ -213,6 +213,7 @@ func TestHistoryContext_Table(t *testing.T) { {ID: "imageID6", Created: oldDate, CreatedBy: "/bin/bash echo", Size: int64(182964289), Comment: "Hi", Tags: []string{"image:tag2"}}, } + //nolint:dupword // ignore "Duplicate words (CREATED) found" const expectedNoTrunc = `IMAGE CREATED CREATED BY SIZE COMMENT 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 imageID2 24 hours ago /bin/bash echo 183MB Hi @@ -221,6 +222,7 @@ imageID4 24 hours ago /bin/bash grep imageID5 N/A /bin/bash echo 183MB Hi imageID6 17 years ago /bin/bash echo 183MB Hi ` + //nolint:dupword // ignore "Duplicate words (CREATED) found" const expectedTrunc = `IMAGE CREATED CREATED BY SIZE COMMENT imageID1 24 hours ago /bin/bash ls && npm i && npm run test && kar… 183MB Hi imageID2 24 hours ago /bin/bash echo 183MB Hi diff --git a/cli/command/service/parse.go b/cli/command/service/parse.go index 25677d3841..56265e9545 100644 --- a/cli/command/service/parse.go +++ b/cli/command/service/parse.go @@ -71,7 +71,7 @@ func ParseConfigs(client client.ConfigAPIClient, requestedConfigs []*swarmtypes. } // the configRefs map has two purposes: it prevents duplication of config - // target filenames, and it it used to get all configs so we can resolve + // target filenames. It is used to get all configs, so we can resolve // their IDs. unfortunately, there are other targets for ConfigReferences, // besides just a File; specifically, the Runtime target, which is used for // CredentialSpecs. Therefore, we need to have a list of ConfigReferences diff --git a/cli/command/service/update.go b/cli/command/service/update.go index c4672493aa..5ed39d909b 100644 --- a/cli/command/service/update.go +++ b/cli/command/service/update.go @@ -1365,7 +1365,7 @@ func updateCredSpecConfig(flags *pflag.FlagSet, containerSpec *swarm.ContainerSp // otherwise, set the credential spec to be the parsed value credSpec := credSpecOpt.Value.(*credentialSpecOpt).Value() - // if this is a Config credential spec, we we still need to replace the + // if this is a Config credential spec, we still need to replace the // value of credSpec.Config with the config ID instead of Name. if credSpec.Config != "" { for _, config := range containerSpec.Configs { diff --git a/cli/command/service/update_test.go b/cli/command/service/update_test.go index fc30e7be56..db884b84fb 100644 --- a/cli/command/service/update_test.go +++ b/cli/command/service/update_test.go @@ -1056,7 +1056,7 @@ func TestUpdateGetUpdatedConfigs(t *testing.T) { }, } // cannedConfigRefs is the same thing, but with config references instead - // instead of ID, however, it just maps an arbitrary string value. this is + // of ID, however, it just maps an arbitrary string value. this is // so we could have multiple config refs using the same config cannedConfigRefs := map[string]*swarm.ConfigReference{ "fooRef": { diff --git a/cli/trust/trust.go b/cli/trust/trust.go index f248164438..575d48f6de 100644 --- a/cli/trust/trust.go +++ b/cli/trust/trust.go @@ -262,8 +262,8 @@ func GetSignableRoles(repo client.Repository, target *client.Target) ([]data.Rol return signableRoles, nil } - // there are delegation roles, find every delegation role we have a key for, and - // attempt to sign into into all those roles. + // there are delegation roles, find every delegation role we have a key for, + // and attempt to sign in to all those roles. for _, delegationRole := range allDelegationRoles { // We do not support signing any delegation role that isn't a direct child of the targets role. // Also don't bother checking the keys if we can't add the target