Skip to content

Commit 4dd86ec

Browse files
committed
chore: enable unnecessary-stmt rule from revive
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent 488f215 commit 4dd86ec

File tree

4 files changed

+3
-25
lines changed

4 files changed

+3
-25
lines changed

client/pkg/types/urls.go

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ func NewURLs(strs []string) (URLs, error) {
4747
return nil, fmt.Errorf("URL must not contain a path: %s", in)
4848
}
4949
case "unix", "unixs":
50-
break
5150
default:
5251
return nil, fmt.Errorf("URL scheme must be http, https, unix, or unixs: %s", in)
5352
}

server/etcdmain/etcd.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ func startEtcdOrProxyV2(args []string) {
6464
lg.Info("Running: ", zap.Strings("args", args))
6565
if err != nil {
6666
lg.Warn("failed to verify flags", zap.Error(err))
67-
switch {
68-
case errorspkg.Is(err, embed.ErrUnsetAdvertiseClientURLsFlag):
67+
if errorspkg.Is(err, embed.ErrUnsetAdvertiseClientURLsFlag) {
6968
lg.Warn("advertise client URLs are not set", zap.Error(err))
7069
}
7170
os.Exit(1)

server/storage/wal/repair.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ func Repair(lg *zap.Logger, dirpath string) bool {
4949
switch {
5050
case err == nil:
5151
// update crc of the decoder when necessary
52-
switch rec.Type {
53-
case CrcType:
52+
if rec.Type == CrcType {
5453
crc := decoder.LastCRC()
5554
// current crc of decoder must match the crc of the record.
5655
// do no need to match 0 crc, since the decoder is a new one at this case.

tools/.golangci.yaml

+1-20
Original file line numberDiff line numberDiff line change
@@ -47,49 +47,30 @@ linters-settings: # please keep this alphabetized
4747
confidence: 0.8
4848
rules:
4949
- name: blank-imports
50-
disabled: false
5150
- name: context-as-argument
52-
disabled: false
5351
- name: context-keys-type
54-
disabled: false
5552
- name: dot-imports
56-
disabled: false
5753
- name: early-return
58-
disabled: false
5954
arguments:
6055
- "preserveScope"
6156
- name: error-return
62-
disabled: false
6357
- name: error-naming
64-
disabled: false
6558
- name: error-strings
66-
disabled: false
6759
- name: errorf
68-
disabled: false
6960
- name: if-return
70-
disabled: false
7161
- name: increment-decrement
72-
disabled: false
7362
- name: indent-error-flow
74-
disabled: false
7563
- name: package-comments
76-
disabled: false
7764
- name: range
78-
disabled: false
7965
- name: receiver-naming
80-
disabled: false
8166
- name: superfluous-else
82-
disabled: false
8367
arguments:
8468
- "preserveScope"
8569
- name: time-naming
86-
disabled: false
70+
- name: unnecessary-stmt
8771
- name: use-any
88-
disabled: false
8972
- name: var-declaration
90-
disabled: false
9173
- name: var-naming
92-
disabled: false
9374
arguments:
9475
# The following is the configuration for var-naming rule, the first element is the allow list and the second element is the deny list.
9576
- [] # AllowList: leave it empty to use the default (empty, too). This means that we're not relaxing the rule in any way, i.e. elementId will raise a violation, it should be elementID, refer to the next line to see the list of denied initialisms.

0 commit comments

Comments
 (0)