mirror of https://github.com/docker/cli.git
golangci-lint: enable exhaustive linter
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
b64d9b3b19
commit
d65f0c9bbf
|
@ -34,6 +34,7 @@ linters:
|
|||
- durationcheck # Detect cases where two time.Duration values are being multiplied in possibly erroneous ways.
|
||||
- errcheck
|
||||
- errchkjson # Detects unsupported types passed to json encoding functions and reports if checks for the returned error can be omitted.
|
||||
- exhaustive # Detects missing options in enum switch statements.
|
||||
- forbidigo
|
||||
- gocritic # Metalinter; detects bugs, performance, and styling issues.
|
||||
- gocyclo
|
||||
|
|
|
@ -81,7 +81,7 @@ func addPluginCandidatesFromDir(res map[string][]string, d string) {
|
|||
return
|
||||
}
|
||||
for _, dentry := range dentries {
|
||||
switch dentry.Type() & os.ModeType {
|
||||
switch dentry.Type() & os.ModeType { //nolint:exhaustive,nolintlint // no need to include all possible file-modes in this list
|
||||
case 0, os.ModeSymlink:
|
||||
// Regular file or symlink, keep going
|
||||
default:
|
||||
|
|
|
@ -20,6 +20,8 @@ func charWidth(r rune) int {
|
|||
switch width.LookupRune(r).Kind() {
|
||||
case width.EastAsianWide, width.EastAsianFullwidth:
|
||||
return 2
|
||||
case width.Neutral, width.EastAsianAmbiguous, width.EastAsianNarrow, width.EastAsianHalfwidth:
|
||||
return 1
|
||||
default:
|
||||
return 1
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ func runUnlock(ctx context.Context, dockerCli command.Cli) error {
|
|||
return errors.New("Error: This node is not part of a swarm")
|
||||
case swarm.LocalNodeStateLocked:
|
||||
break
|
||||
default:
|
||||
case swarm.LocalNodeStatePending, swarm.LocalNodeStateActive, swarm.LocalNodeStateError:
|
||||
return errors.New("Error: swarm is not locked")
|
||||
}
|
||||
|
||||
|
@ -58,11 +58,10 @@ func runUnlock(ctx context.Context, dockerCli command.Cli) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req := swarm.UnlockRequest{
|
||||
UnlockKey: key,
|
||||
}
|
||||
|
||||
return client.SwarmUnlock(ctx, req)
|
||||
return client.SwarmUnlock(ctx, swarm.UnlockRequest{
|
||||
UnlockKey: key,
|
||||
})
|
||||
}
|
||||
|
||||
func readKey(in *streams.In, prompt string) (string, error) {
|
||||
|
|
Loading…
Reference in New Issue