Skip to content

Go: fix development guide - #16678

Merged
JinHai-CN merged 3 commits into
infiniflow:mainfrom
JinHai-CN:fix520
Jul 7, 2026
Merged

JinHai-CN merged 3 commits into
infiniflow:mainfrom
JinHai-CN:fix520

Conversation

@JinHai-CN

Copy link
Copy Markdown
Member

Summary

Go development guide

@coderabbitai

coderabbitai Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

build.sh now requires clang++ for C++ dependency checks. internal/development.md was reorganized with new dependency setup, build/start instructions, and a larger CLI command reference. A new Python helper downloads and extracts ragflow_deps build artifacts with optional China mirror support.

Changes

Toolchain and Development Guide

Layer / File(s) Summary
Clang++ dependency check
build.sh
Replaces the g++ requirement with a clang++ check in check_cpp_deps().
Dependency setup and service startup guide
internal/development.md
Adds dependency installation, build/start steps, frontend startup, and service routing guidance.
Command reference restructuring
internal/development.md
Renumbers and expands provider, model, chat, embedding, media, dataset, chunk, metadata, and search command sections.

Go Dependency Downloader

Layer / File(s) Summary
Script setup and URL sourcing
ragflow_deps/download_go_deps.py
Adds script metadata, imports, and URL selection logic with optional China mirror substitution.
Download loop and extraction flow
ragflow_deps/download_go_deps.py
Adds progress-aware downloads, CLI execution flow, skipping existing files, and native archive extraction.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Main
  participant get_urls
  participant HTTPServer
  participant download_with_progress
  participant FileSystem

  Main->>get_urls: get_urls(use_china_mirrors)
  get_urls-->>Main: artifact URLs and filenames
  loop each artifact
    Main->>FileSystem: check if target exists
    alt target missing
      Main->>download_with_progress: download_with_progress(url, filename)
      download_with_progress->>HTTPServer: GET stream
      HTTPServer-->>download_with_progress: file bytes + content-length
      download_with_progress->>FileSystem: write file and print progress
    end
  end
  Main->>FileSystem: extract archives into ~/ragflow-native-libs
Loading

Possibly related PRs

  • infiniflow/ragflow#16229: Overlaps with the dataset and search command documentation updates in internal/development.md.

Suggested reviewers: yingfeng, yuzhichang

Poem

A rabbit hopped through docs and code,
Swapped clang in where the build once strode.
I nibbled mirrors, scripts, and clues,
Then packed the libs for tidy use.
🐇✨ Hop hop, the path is known!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description only repeats the guide topic and lacks the required summary details and background context. Expand the Summary with the problem being solved, why the guide changed, and the key updates reviewers should expect.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title matches the main change: updates to the Go development guide and related build/dependency setup.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JinHai-CN JinHai-CN added the ci Continue Integration label Jul 6, 2026
@JinHai-CN
JinHai-CN marked this pull request as ready for review July 6, 2026 12:02
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. 📖 documentation Improvements or additions to documentation labels Jul 6, 2026
@JinHai-CN
JinHai-CN marked this pull request as draft July 6, 2026 12:02
@JinHai-CN
JinHai-CN marked this pull request as ready for review July 6, 2026 12:02
Signed-off-by: Jin Hai <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
ragflow_deps/download_go_deps.py (4)

33-37: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use logging instead of print for this new download/extract flow.

This new script drives a multi-step download and extraction flow but reports progress/errors via print. Adding a module logging setup would make failures diagnosable in CI logs.

As per coding guidelines: "Add logging for new flows".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ragflow_deps/download_go_deps.py` around lines 33 - 37, The new
download/extract flow in download_go_deps.py is using print for progress and
errors instead of logging. Add a module-level logging setup and replace the
print statements in the download/extract path with logger calls in the relevant
functions that handle the flow so failures show up clearly in CI logs.

Source: Coding guidelines


39-89: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Deduplicate the two URL lists to avoid version drift.

The China-mirror branch is identical to the default branch except for a https://gh-proxy.com/ prefix, yet both hardcode the same versions and comments. When a URL/version is bumped in one branch and not the other, the mirrors silently diverge. Consider defining the URLs once and applying the prefix conditionally.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ragflow_deps/download_go_deps.py` around lines 39 - 89, The get_urls function
currently duplicates the same URL list in both branches, which can drift when
versions change. Refactor get_urls so the base URLs and comments are defined
once, then apply the gh-proxy.com prefix conditionally when use_china_mirrors is
true. Use get_urls as the main entry point and keep the returned list shape
unchanged for both string URLs and [url, filename] entries.

25-25: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Stale filename in workflow comment.

This file is download_go_deps.py, but the example invokes download_deps.py.

✏️ Proposed fix
-#   uv run python3 ragflow_deps/download_deps.py            # download
+#   uv run python3 ragflow_deps/download_go_deps.py         # download
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ragflow_deps/download_go_deps.py` at line 25, The workflow comment references
the wrong script name, since this file is download_go_deps.py but the example
still points to download_deps.py. Update the comment near the download example
to use the correct filename so the documented command matches the actual helper
script; check the surrounding usage text in download_go_deps.py and keep the
rest of the instructions unchanged.

133-135: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Misleading log when file already exists.

print(f"Downloading {filename}...") runs before the os.path.exists guard, so cached files log "Downloading" then are skipped. Move the print inside the if block. The commented-out urllib opener (Lines 124-128) is now dead code and can be removed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ragflow_deps/download_go_deps.py` around lines 133 - 135, The download
logging in download_with_progress handling is misleading because it prints a
“Downloading” message before the os.path.exists check, even when the file is
already cached. Move the print statement inside the existing if not
os.path.exists(filename) block so it only logs when download_with_progress is
actually called, and remove the dead commented-out urllib opener code near that
section.
internal/development.md (1)

156-191: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Renumber the command reference consistently.

Several inserted headings still reuse section numbers (5.5, 5.15, 5.25) and skip the next number, which makes anchors and manual cross-references ambiguous. Please renumber the affected subsections as part of this pass.

Also applies to: 327-366, 506-523

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/development.md` around lines 156 - 191, The documentation subsection
numbers are duplicated and out of sequence around the provider/model commands,
which makes references ambiguous. Renumber the affected headings in the “List
currently supported providers”, “Add or delete a provider for the current
tenant”, “Create a model instance for a specific provider”, “List and delete an
instance”, “List models supported by a model instance”, and “Chat with LLM”
sections so they follow one consistent sequence. Also update any in-document
anchors or cross-references that point to these headings so they match the new
numbering.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/development.md`:
- Around line 31-36: The Go install steps have a tarball filename mismatch: the
download command in the setup snippet fetches a newer archive, but the
extraction command in the same block still references the older filename. Update
the extraction step to use the same archive name as the download in the
development setup instructions so the sequence works reliably; use the wget and
sudo tar commands in that snippet as the places to fix.

---

Nitpick comments:
In `@internal/development.md`:
- Around line 156-191: The documentation subsection numbers are duplicated and
out of sequence around the provider/model commands, which makes references
ambiguous. Renumber the affected headings in the “List currently supported
providers”, “Add or delete a provider for the current tenant”, “Create a model
instance for a specific provider”, “List and delete an instance”, “List models
supported by a model instance”, and “Chat with LLM” sections so they follow one
consistent sequence. Also update any in-document anchors or cross-references
that point to these headings so they match the new numbering.

In `@ragflow_deps/download_go_deps.py`:
- Around line 33-37: The new download/extract flow in download_go_deps.py is
using print for progress and errors instead of logging. Add a module-level
logging setup and replace the print statements in the download/extract path with
logger calls in the relevant functions that handle the flow so failures show up
clearly in CI logs.
- Around line 39-89: The get_urls function currently duplicates the same URL
list in both branches, which can drift when versions change. Refactor get_urls
so the base URLs and comments are defined once, then apply the gh-proxy.com
prefix conditionally when use_china_mirrors is true. Use get_urls as the main
entry point and keep the returned list shape unchanged for both string URLs and
[url, filename] entries.
- Line 25: The workflow comment references the wrong script name, since this
file is download_go_deps.py but the example still points to download_deps.py.
Update the comment near the download example to use the correct filename so the
documented command matches the actual helper script; check the surrounding usage
text in download_go_deps.py and keep the rest of the instructions unchanged.
- Around line 133-135: The download logging in download_with_progress handling
is misleading because it prints a “Downloading” message before the
os.path.exists check, even when the file is already cached. Move the print
statement inside the existing if not os.path.exists(filename) block so it only
logs when download_with_progress is actually called, and remove the dead
commented-out urllib opener code near that section.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a8eed5c1-f07b-45ec-81a3-56ee9b3ea3d3

📥 Commits

Reviewing files that changed from the base of the PR and between 55af1d7 and 5eaa7d7.

📒 Files selected for processing (3)
  • build.sh
  • internal/development.md
  • ragflow_deps/download_go_deps.py

Comment thread internal/development.md
Comment on lines +31 to +36
wget https://go.dev/dl/go1.25.4.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
go version

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fix the Go tarball filename mismatch.

You download go1.25.4.linux-amd64.tar.gz but extract go1.23.4.linux-amd64.tar.gz, so the commands fail unless an old archive is already present. Use the same filename in both steps.

🛠️ Suggested fix
-wget https://go.dev/dl/go1.25.4.linux-amd64.tar.gz
+wget https://go.dev/dl/go1.25.4.linux-amd64.tar.gz
 sudo rm -rf /usr/local/go
-sudo tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz
+sudo tar -C /usr/local -xzf go1.25.4.linux-amd64.tar.gz
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
wget https://go.dev/dl/go1.25.4.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
go version
wget https://go.dev/dl/go1.25.4.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.25.4.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
go version
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/development.md` around lines 31 - 36, The Go install steps have a
tarball filename mismatch: the download command in the setup snippet fetches a
newer archive, but the extraction command in the same block still references the
older filename. Update the extraction step to use the same archive name as the
download in the development setup instructions so the sequence works reliably;
use the wget and sudo tar commands in that snippet as the places to fix.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (3a247db) to head (23bfc98).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16678   +/-   ##
=======================================
  Coverage   93.16%   93.16%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          668      668           
  Misses         29       29           
  Partials       20       20           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JinHai-CN
JinHai-CN merged commit 9eba452 into infiniflow:main Jul 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration 📖 documentation Improvements or additions to documentation size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant