Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable unnecessary-stmt rule from revive #19155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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
Loading