Repository navigation
Go: fix development guide - #16678
Conversation
Signed-off-by: Jin Hai <[email protected]>
📝 WalkthroughWalkthroughbuild.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. ChangesToolchain and Development Guide
Go Dependency Downloader
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
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
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. Comment |
Signed-off-by: Jin Hai <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (5)
ragflow_deps/download_go_deps.py (4)
33-37: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
logginginstead ofThis new script drives a multi-step download and extraction flow but reports progress/errors via
loggingsetup 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 winDeduplicate 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 valueStale filename in workflow comment.
This file is
download_go_deps.py, but the example invokesdownload_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 valueMisleading log when file already exists.
print(f"Downloading {filename}...")runs before theos.path.existsguard, so cached files log "Downloading" then are skipped. Move the print inside theifblock. The commented-outurllibopener (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 winRenumber 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
📒 Files selected for processing (3)
build.shinternal/development.mdragflow_deps/download_go_deps.py
| 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 |
There was a problem hiding this comment.
🎯 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.
| 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Summary
Go development guide