Go: fix warnings (#17738)

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-08-03 21:30:01 +08:00
committed by GitHub
parent d357eea8ef
commit 86021932ae
103 changed files with 437 additions and 439 deletions

View File

@@ -1253,7 +1253,7 @@ async def update_metadata_config(tenant_id, dataset_id, document_id):
try:
e, doc = DocumentService.get_by_id(doc.id)
if not e:
return get_data_error_result(message="Document not found!")
return get_data_error_result(message="document not found")
except Exception as e:
return get_json_result(code=RetCode.EXCEPTION_ERROR, message=repr(e))
@@ -1462,7 +1462,7 @@ def _run_sync(user_id: str, req):
return RetCode.DATA_ERROR, "Tenant not found!"
e, doc = DocumentService.get_by_id(doc_id)
if not e:
return RetCode.DATA_ERROR, "Document not found!"
return RetCode.DATA_ERROR, "document not found"
if str(req["run"]) == TaskStatus.CANCEL.value:
tasks = list(TaskService.query(doc_id=doc_id))
@@ -1904,7 +1904,7 @@ async def get_artifact(filename):
return get_data_error_result(message="Invalid filename.")
ext = os.path.splitext(basename)[1].lower()
if ext not in ARTIFACT_CONTENT_TYPES:
return get_data_error_result(message="Invalid file type.")
return get_data_error_result(message="invalid file type")
session_id = request.args.get("session_id", "")
if not await thread_pool_exec(_sandbox_artifact_accessible, basename, current_user.id) and not await thread_pool_exec(_sandbox_artifact_session_accessible, session_id, current_user.id):
return get_data_error_result(message="Artifact not found.")
@@ -2054,11 +2054,11 @@ async def get(doc_id):
"""
try:
if not DocumentService.accessible(doc_id, current_user.id):
return get_data_error_result(message="Document not found!")
return get_data_error_result(message="document not found")
e, doc = DocumentService.get_by_id(doc_id)
if not e:
return get_data_error_result(message="Document not found!")
return get_data_error_result(message="document not found")
b, n = File2DocumentService.get_storage_address(doc_id=doc_id)
data = await thread_pool_exec(settings.STORAGE_IMPL.get, b, n)
@@ -2128,9 +2128,9 @@ async def download(dataset_id, document_id):
if not document_id:
return get_error_data_result(message="Specify document_id please.")
if not KnowledgebaseService.accessible(kb_id=dataset_id, user_id=current_user.id):
return get_data_error_result(message="Document not found!")
return get_data_error_result(message="document not found")
if not DocumentService.accessible(document_id, current_user.id):
return get_data_error_result(message="Document not found!")
return get_data_error_result(message="document not found")
doc = DocumentService.query(kb_id=dataset_id, id=document_id)
if not doc:
return get_error_data_result(message=f"The dataset not own the document {document_id}.")
@@ -2190,7 +2190,7 @@ async def download_document(document_id):
if not document_id:
return get_error_data_result(message="Specify document_id please.")
if not DocumentService.accessible(document_id, current_user.id):
return get_data_error_result(message="Document not found!")
return get_data_error_result(message="document not found")
doc = DocumentService.query(id=document_id)
if not doc:
return get_error_data_result(message=f"The dataset not own the document {document_id}.")