fix(web_search): align with CONVENTION.md var ordering and function order - #79
Merged
Merged
Conversation
…rder Several var blocks declared results before hit (or body before the loop variables that get assigned first), and formatResults sat above the backend functions it's actually called after. Convention.md requires declaration order to follow first use, and helpers to appear in the order their caller invokes them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
A convention pass over the just-merged #78 found violations of docs/CONVENTION.md in
modules/web_search/web_search.goand its test:braveSearch/tavilySearch/ollamaSearchdeclaredresultsbeforehit, buthitis what thefor _, hit = range ...loop actually assigns first each iteration —resultsis only touched inside the loop body afterward.formatResultsdeclaredbodybeforeindex/result, but thefor index, result = range resultsassigns those first;body.WriteStringonly happens after.formatResultsitself was defined above the three backend functions even thoughSearch'sExecutecalls it only after (and outside) the backend dispatch switch — CONVENTION.md wants helpers ordered by when their caller actually invokes them.lookup/wantErr,got/results).How it was verified
make test-racepassesChecklist
:=, onevarblock per function in first-use order witherrlast, callees before callers, andmainunconditionally last.gofiles carry the two-line SPDX headerGPL-3.0-only, matching the project