mirror of https://github.com/docker/cli.git
golangci-lint: enable dupword linter
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
2d61f70f00
commit
7e9d2c78c6
|
@ -3,6 +3,7 @@ linters:
|
||||||
- bodyclose
|
- bodyclose
|
||||||
- depguard
|
- depguard
|
||||||
- dogsled
|
- dogsled
|
||||||
|
- dupword # Detects duplicate words.
|
||||||
- gocyclo
|
- gocyclo
|
||||||
- gofumpt
|
- gofumpt
|
||||||
- goimports
|
- goimports
|
||||||
|
|
|
@ -24,7 +24,7 @@ const (
|
||||||
pidsHeader = "PIDS" // Used only on Linux
|
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 {
|
type StatsEntry struct {
|
||||||
Container string
|
Container string
|
||||||
Name string
|
Name string
|
||||||
|
|
|
@ -44,6 +44,8 @@ type EndpointDefaultResolver interface {
|
||||||
// the lack of a default (e.g. because the config file which
|
// the lack of a default (e.g. because the config file which
|
||||||
// would contain it is missing). If there is no default then
|
// would contain it is missing). If there is no default then
|
||||||
// returns nil, nil, nil.
|
// returns nil, nil, nil.
|
||||||
|
//
|
||||||
|
//nolint:dupword // ignore "Duplicate words (nil,) found"
|
||||||
ResolveDefault() (interface{}, *store.EndpointTLSData, error)
|
ResolveDefault() (interface{}, *store.EndpointTLSData, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ image tag2 imageID2 N/A 0B
|
||||||
Format: NewImageFormat("table {{.Repository}}", false, false),
|
Format: NewImageFormat("table {{.Repository}}", false, false),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"REPOSITORY\nimage\nimage\n<none>\n",
|
"REPOSITORY\nimage\nimage\n<none>\n", //nolint:dupword // ignore "Duplicate words (image) found"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ImageContext{
|
ImageContext{
|
||||||
|
@ -169,7 +169,7 @@ image <none>
|
||||||
Format: NewImageFormat("table {{.Repository}}", true, false),
|
Format: NewImageFormat("table {{.Repository}}", true, false),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"REPOSITORY\nimage\nimage\n<none>\n",
|
"REPOSITORY\nimage\nimage\n<none>\n", //nolint:dupword // ignore "Duplicate words (image) found"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ImageContext{
|
ImageContext{
|
||||||
|
@ -284,7 +284,7 @@ image_id: imageID3
|
||||||
Format: NewImageFormat("{{.Repository}}", false, false),
|
Format: NewImageFormat("{{.Repository}}", false, false),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"image\nimage\n<none>\n",
|
"image\nimage\n<none>\n", //nolint:dupword // ignore "Duplicate words (image) found"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ImageContext{
|
ImageContext{
|
||||||
|
@ -293,7 +293,7 @@ image_id: imageID3
|
||||||
},
|
},
|
||||||
Digest: true,
|
Digest: true,
|
||||||
},
|
},
|
||||||
"image\nimage\n<none>\n",
|
"image\nimage\n<none>\n", //nolint:dupword // ignore "Duplicate words (image) found"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ const (
|
||||||
//
|
//
|
||||||
// minwidth minimal cell width including any padding
|
// minwidth minimal cell width including any padding
|
||||||
// tabwidth width of tab characters (equivalent number of spaces)
|
// 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
|
// padchar ASCII char used for padding
|
||||||
// if padchar == '\t', the Writer will assume that the
|
// if padchar == '\t', the Writer will assume that the
|
||||||
// width of a '\t' in the formatted output is tabwidth,
|
// width of a '\t' in the formatted output is tabwidth,
|
||||||
|
|
|
@ -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"}},
|
{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
|
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
|
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
|
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
|
imageID5 N/A /bin/bash echo 183MB Hi
|
||||||
imageID6 17 years ago /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
|
const expectedTrunc = `IMAGE CREATED CREATED BY SIZE COMMENT
|
||||||
imageID1 24 hours ago /bin/bash ls && npm i && npm run test && kar… 183MB Hi
|
imageID1 24 hours ago /bin/bash ls && npm i && npm run test && kar… 183MB Hi
|
||||||
imageID2 24 hours ago /bin/bash echo 183MB Hi
|
imageID2 24 hours ago /bin/bash echo 183MB Hi
|
||||||
|
|
|
@ -71,7 +71,7 @@ func ParseConfigs(client client.ConfigAPIClient, requestedConfigs []*swarmtypes.
|
||||||
}
|
}
|
||||||
|
|
||||||
// the configRefs map has two purposes: it prevents duplication of config
|
// 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,
|
// their IDs. unfortunately, there are other targets for ConfigReferences,
|
||||||
// besides just a File; specifically, the Runtime target, which is used for
|
// besides just a File; specifically, the Runtime target, which is used for
|
||||||
// CredentialSpecs. Therefore, we need to have a list of ConfigReferences
|
// CredentialSpecs. Therefore, we need to have a list of ConfigReferences
|
||||||
|
|
|
@ -1365,7 +1365,7 @@ func updateCredSpecConfig(flags *pflag.FlagSet, containerSpec *swarm.ContainerSp
|
||||||
// otherwise, set the credential spec to be the parsed value
|
// otherwise, set the credential spec to be the parsed value
|
||||||
credSpec := credSpecOpt.Value.(*credentialSpecOpt).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.
|
// value of credSpec.Config with the config ID instead of Name.
|
||||||
if credSpec.Config != "" {
|
if credSpec.Config != "" {
|
||||||
for _, config := range containerSpec.Configs {
|
for _, config := range containerSpec.Configs {
|
||||||
|
|
|
@ -1056,7 +1056,7 @@ func TestUpdateGetUpdatedConfigs(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
// cannedConfigRefs is the same thing, but with config references instead
|
// 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
|
// so we could have multiple config refs using the same config
|
||||||
cannedConfigRefs := map[string]*swarm.ConfigReference{
|
cannedConfigRefs := map[string]*swarm.ConfigReference{
|
||||||
"fooRef": {
|
"fooRef": {
|
||||||
|
|
|
@ -262,8 +262,8 @@ func GetSignableRoles(repo client.Repository, target *client.Target) ([]data.Rol
|
||||||
return signableRoles, nil
|
return signableRoles, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// there are delegation roles, find every delegation role we have a key for, and
|
// there are delegation roles, find every delegation role we have a key for,
|
||||||
// attempt to sign into into all those roles.
|
// and attempt to sign in to all those roles.
|
||||||
for _, delegationRole := range allDelegationRoles {
|
for _, delegationRole := range allDelegationRoles {
|
||||||
// We do not support signing any delegation role that isn't a direct child of the targets role.
|
// 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
|
// Also don't bother checking the keys if we can't add the target
|
||||||
|
|
Loading…
Reference in New Issue