Skip to content

Commit

Permalink
chore: enable unnecessary-stmt rule from revive
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 committed Jan 9, 2025
1 parent 0f172d4 commit 57aec15
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 32 deletions.
1 change: 0 additions & 1 deletion client/pkg/types/urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func NewURLs(strs []string) (URLs, error) {
return nil, fmt.Errorf("URL must not contain a path: %s", in)
}
case "unix", "unixs":
break
default:
return nil, fmt.Errorf("URL scheme must be http, https, unix, or unixs: %s", in)
}
Expand Down
3 changes: 1 addition & 2 deletions server/etcdmain/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ func startEtcdOrProxyV2(args []string) {
lg.Info("Running: ", zap.Strings("args", args))
if err != nil {
lg.Warn("failed to verify flags", zap.Error(err))
switch {
case errorspkg.Is(err, embed.ErrUnsetAdvertiseClientURLsFlag):
if errorspkg.Is(err, embed.ErrUnsetAdvertiseClientURLsFlag) {

Check warning on line 67 in server/etcdmain/etcd.go

View check run for this annotation

Codecov / codecov/patch

server/etcdmain/etcd.go#L67

Added line #L67 was not covered by tests
lg.Warn("advertise client URLs are not set", zap.Error(err))
}
os.Exit(1)
Expand Down
3 changes: 1 addition & 2 deletions server/storage/wal/repair.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ func Repair(lg *zap.Logger, dirpath string) bool {
switch {
case err == nil:
// update crc of the decoder when necessary
switch rec.Type {
case CrcType:
if rec.Type == CrcType {
crc := decoder.LastCRC()
// current crc of decoder must match the crc of the record.
// do no need to match 0 crc, since the decoder is a new one at this case.
Expand Down
37 changes: 10 additions & 27 deletions tools/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,58 +44,41 @@ linters-settings: # please keep this alphabetized
# Align with https://github.com/alexkohler/nakedret/blob/v1.0.2/cmd/nakedret/main.go#L10
max-func-lines: 5
revive:
ignore-generated-header: false
severity: error
confidence: 0.8
enable-all-rules: false
rules:
- name: blank-imports
severity: error
disabled: false
- name: context-as-argument
severity: error
disabled: false
- name: context-keys-type
disabled: false
- name: dot-imports
severity: error
disabled: false
- name: error-naming
disabled: false
- name: error-return
severity: error
disabled: false
- name: error-naming
severity: error
- name: error-strings
disabled: false
- name: errorf
disabled: false
- name: if-return
severity: error
disabled: false
- name: increment-decrement
severity: error
disabled: false
- name: var-declaration
severity: error
- name: indent-error-flow
disabled: false
- name: package-comments
severity: error
disabled: false
- name: range
severity: error
disabled: false
- name: receiver-naming
severity: error
disabled: false
- name: time-naming
severity: error
disabled: false
- name: indent-error-flow
severity: error
disabled: false
- name: errorf
severity: error
disabled: false
- name: context-keys-type
severity: error
- name: unnecessary-stmt
disabled: false
- name: error-strings
severity: error
- name: var-declaration
disabled: false
- name: var-naming
disabled: false
Expand Down

0 comments on commit 57aec15

Please sign in to comment.