[PR #7855] [CLOSED] refactor: Use map instead of switch #38411

Closed
opened 2026-04-22 23:05:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/7855
Author: @shirayu
Created: 11/27/2024
Status: Closed

Base: mainHead: filetype_map


📝 Commits (2)

  • a097e52 refactor: Use map instead of switch
  • 61f6f63 tests: Add tests for filetype.go

📊 Changes

2 files changed (+86 additions, -130 deletions)

View changed files

📝 llm/filetype.go (+43 -130)
llm/filetype_test.go (+43 -0)

📄 Description

This PR replaces two long switch statements with a simpler map.
Additionally, test code has been added.
This improves both readability and maintainability.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/7855 **Author:** [@shirayu](https://github.com/shirayu) **Created:** 11/27/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `filetype_map` --- ### 📝 Commits (2) - [`a097e52`](https://github.com/ollama/ollama/commit/a097e5227b4436e05e21baae16f8c56e42818ac1) refactor: Use map instead of switch - [`61f6f63`](https://github.com/ollama/ollama/commit/61f6f630cc8dd52100d46c588fa3ab2b6844d5b1) tests: Add tests for filetype.go ### 📊 Changes **2 files changed** (+86 additions, -130 deletions) <details> <summary>View changed files</summary> 📝 `llm/filetype.go` (+43 -130) ➕ `llm/filetype_test.go` (+43 -0) </details> ### 📄 Description This PR replaces two long `switch` statements with a simpler `map`. Additionally, test code has been added. This improves both readability and maintainability. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-22 23:05:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#38411