Skip to content

Conversation

minxinyi
Copy link
Contributor

In the Go 1.21 standard library, a new function has been introduced that enhances code conciseness and readability. It can be find here.

Signed-off-by: minxinyi <minxinyi6@outlook.com>
Copy link
Member

@jmorganca jmorganca left a comment

Choose a reason for hiding this comment

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

Thank you!

@jmorganca jmorganca merged commit 1e6eab5 into ollama:main Jul 23, 2025
8 checks passed
gabe-l-hart added a commit to gabe-l-hart/ollama that referenced this pull request Jul 25, 2025
* origin/main:
cli: catch upstream errors gracefully (ollama#11512)
tools: loosen tool argument parsing (ollama#11509)
server: use slices.Equal to simplify code (ollama#11502)
s#x/exp/maps#maps# (ollama#11506)
Fix GetModelInfo (ollama#11496)
Update linux.md (ollama#11462)
paulnegz added a commit to paulnegz/slang that referenced this pull request Jul 29, 2025
….Equal

* Implements SliceEqualSimplificationCheck to detect custom slice equality
  functions that can be replaced with Go's built-in slices.Equal() function
* Detects functions with 2 parameters that contain len() comparisons
* Includes comprehensive test coverage with SLang syntax examples
* Addresses refactoring opportunity similar to ollama/ollama#11502

This rule helps Go developers modernize their code by identifying
opportunities to use the standard library's optimized slice comparison
instead of custom implementations.
@paulnegz
Copy link

paulnegz commented Jul 29, 2025

@minxinyi love this fix! Just contributed a new rule to SonarSource that will help Go developers (including future Ollama contributors) automatically identify opportunities to refactor custom slice equality functions to use slices.Equal().

rick-github pushed a commit to rick-github/ollama that referenced this pull request Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants