enhance: Update golangci_lint version (#28535)

Update golangci lint and fix some warnings

Signed-off-by: sunby <sunbingyi1992@gmail.com>
pull/28590/head
Bingyi Sun 2023-11-21 10:04:21 +08:00 committed by GitHub
parent 02c5a649cf
commit d7145e2c06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 12 deletions

View File

@ -35,7 +35,7 @@ ifdef USE_DYNAMIC_SIMD
use_dynamic_simd = ${USE_DYNAMIC_SIMD} use_dynamic_simd = ${USE_DYNAMIC_SIMD}
endif endif
# golangci-lint # golangci-lint
GOLANGCI_LINT_VERSION := 1.53.1 GOLANGCI_LINT_VERSION := 1.55.2
GOLANGCI_LINT_OUTPUT := $(shell $(INSTALL_PATH)/golangci-lint --version 2>/dev/null) GOLANGCI_LINT_OUTPUT := $(shell $(INSTALL_PATH)/golangci-lint --version 2>/dev/null)
INSTALL_GOLANGCI_LINT := $(findstring $(GOLANGCI_LINT_VERSION), $(GOLANGCI_LINT_OUTPUT)) INSTALL_GOLANGCI_LINT := $(findstring $(GOLANGCI_LINT_VERSION), $(GOLANGCI_LINT_OUTPUT))
# mockery # mockery
@ -80,7 +80,7 @@ get-build-deps:
getdeps: getdeps:
@mkdir -p $(INSTALL_PATH) @mkdir -p $(INSTALL_PATH)
@if [ -z "$(INSTALL_GOLANGCI_LINT)" ]; then \ @if [ -z "$(INSTALL_GOLANGCI_LINT)" ]; then \
echo "Installing golangci-lint into ./bin/" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(INSTALL_PATH) v1.53.1 ; \ echo "Installing golangci-lint into ./bin/" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(INSTALL_PATH) v${GOLANGCI_LINT_VERSION} ; \
else \ else \
echo "golangci-lint v@$(GOLANGCI_LINT_VERSION) already installed"; \ echo "golangci-lint v@$(GOLANGCI_LINT_VERSION) already installed"; \
fi fi

View File

@ -773,7 +773,6 @@ func convertEmptyStringToByte(value string) ([]byte, error) {
return EmptyValueByte, nil return EmptyValueByte, nil
} else if value == EmptyValueString { } else if value == EmptyValueString {
return nil, fmt.Errorf("Value for key is reserved by EmptyValue: %s", EmptyValueString) return nil, fmt.Errorf("Value for key is reserved by EmptyValue: %s", EmptyValueString)
} else {
return []byte(value), nil
} }
return []byte(value), nil
} }

View File

@ -432,9 +432,8 @@ func HandleCompare(op int, left, right *ExprWithType) (*planpb.Expr, error) {
return handleCompareRightValue(op, right, valueExpr) return handleCompareRightValue(op, right, valueExpr)
} else if valueExpr := right.expr.GetValueExpr(); valueExpr != nil { } else if valueExpr := right.expr.GetValueExpr(); valueExpr != nil {
return handleCompareRightValue(cmpOp, left, valueExpr) return handleCompareRightValue(cmpOp, left, valueExpr)
} else {
return handleCompare(cmpOp, left, right)
} }
return handleCompare(cmpOp, left, right)
} }
func isEmptyExpression(s string) bool { func isEmptyExpression(s string) bool {

View File

@ -316,10 +316,9 @@ func (p *BinlogAdapter) readDeltalogs(segmentHolder *SegmentFilesHolder) (map[in
} }
log.Info("Binlog adapter: count of deleted entities", zap.Int("deletedCount", len(deletedIDDict))) log.Info("Binlog adapter: count of deleted entities", zap.Int("deletedCount", len(deletedIDDict)))
return nil, deletedIDDict, nil return nil, deletedIDDict, nil
} else { }
log.Warn("Binlog adapter: unsupported primary key type", zap.Int("type", int(primaryKey.GetDataType()))) log.Warn("Binlog adapter: unsupported primary key type", zap.Int("type", int(primaryKey.GetDataType())))
return nil, nil, fmt.Errorf("unsupported primary key type %d, primary key should be int64 or varchar", primaryKey.GetDataType()) return nil, nil, fmt.Errorf("unsupported primary key type %d, primary key should be int64 or varchar", primaryKey.GetDataType())
}
} }
// decodeDeleteLogs decodes string array(read from delta log) to storage.DeleteLog array // decodeDeleteLogs decodes string array(read from delta log) to storage.DeleteLog array
@ -495,10 +494,9 @@ func (p *BinlogAdapter) readPrimaryKeys(logPath string) ([]int64, []string, erro
} }
log.Info("Binlog adapter: succeed to read varchar primary key binlog", zap.Int("len", len(idList))) log.Info("Binlog adapter: succeed to read varchar primary key binlog", zap.Int("len", len(idList)))
return nil, idList, nil return nil, idList, nil
} else { }
log.Warn("Binlog adapter: unsupported primary key type", zap.Int("type", int(primaryKey.GetDataType()))) log.Warn("Binlog adapter: unsupported primary key type", zap.Int("type", int(primaryKey.GetDataType())))
return nil, nil, fmt.Errorf("unsupported primary key type %d, primary key should be int64 or varchar", primaryKey.GetDataType()) return nil, nil, fmt.Errorf("unsupported primary key type %d, primary key should be int64 or varchar", primaryKey.GetDataType())
}
} }
// getShardingListByPrimaryInt64 method generates a shard id list by primary key(int64) list and deleted list. // getShardingListByPrimaryInt64 method generates a shard id list by primary key(int64) list and deleted list.