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 <matthieu.morel35@gmail.com>
  • Loading branch information
mmorel-35 committed Jan 19, 2025
1 parent 88b3938 commit c41fdfd
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 25 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
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

0 comments on commit c41fdfd

Please sign in to comment.