diff --git a/.golangci.yml b/.golangci.yml index 71a295034f..f16bfa547a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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 diff --git a/cli-plugins/manager/manager.go b/cli-plugins/manager/manager.go index 44695a837a..25515bccb8 100644 --- a/cli-plugins/manager/manager.go +++ b/cli-plugins/manager/manager.go @@ -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: diff --git a/cli/command/formatter/displayutils.go b/cli/command/formatter/displayutils.go index a7520e86f2..c6d2845c4e 100644 --- a/cli/command/formatter/displayutils.go +++ b/cli/command/formatter/displayutils.go @@ -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 } diff --git a/cli/command/swarm/unlock.go b/cli/command/swarm/unlock.go index 66ae6d5371..420482ee1e 100644 --- a/cli/command/swarm/unlock.go +++ b/cli/command/swarm/unlock.go @@ -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) {