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
21 changes: 1 addition & 20 deletions tools/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,49 +47,30 @@ linters-settings: # please keep this alphabetized
confidence: 0.8
rules:
- name: blank-imports
disabled: false
- name: context-as-argument
disabled: false
- name: context-keys-type
disabled: false
- name: dot-imports
disabled: false
- name: early-return
disabled: false
arguments:
- "preserveScope"
- name: error-return
disabled: false
- name: error-naming
disabled: false
- name: error-strings
disabled: false
- name: errorf
disabled: false
- name: if-return
disabled: false
- name: increment-decrement
disabled: false
- name: indent-error-flow
disabled: false
- name: package-comments
disabled: false
- name: range
disabled: false
- name: receiver-naming
disabled: false
- name: superfluous-else
disabled: false
arguments:
- "preserveScope"
- name: time-naming
disabled: false
- name: unnecessary-stmt
- name: use-any
disabled: false
- name: var-declaration
disabled: false
- name: var-naming
disabled: false
arguments:
# The following is the configuration for var-naming rule, the first element is the allow list and the second element is the deny list.
- [] # 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.
Expand Down
Loading