This is an automated email from the ASF dual-hosted git repository.

hsluoyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/casbin-gateway.git


The following commit(s) were added to refs/heads/master by this push:
     new cf93c7f  fix(controllers): drop Go 1.21 slices dependency
cf93c7f is described below

commit cf93c7f5b4a69aa1db1b15f5b4963bb0f426de2c
Author: Yang Luo <[email protected]>
AuthorDate: Fri Aug 21 14:49:00 2026 +0800

    fix(controllers): drop Go 1.21 slices dependency
---
 controllers/agent_config.go | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/controllers/agent_config.go b/controllers/agent_config.go
index 58041c3..2686c2f 100644
--- a/controllers/agent_config.go
+++ b/controllers/agent_config.go
@@ -16,7 +16,6 @@ package controllers
 
 import (
        "encoding/json"
-       "slices"
        "sort"
 
        "github.com/apache/casbin-gateway/agent"
@@ -89,7 +88,7 @@ func (collected *agentConfigs) add(agentId string, owner 
string, name string, pa
        inventory := agentconfig.Read(agentId, owner)
        key := inventory.SkillsDir + "\x00" + inventory.McpFile
        if first, ok := collected.seen[key]; ok {
-               if first.AgentId != agentId && 
!slices.Contains(first.SharedWith, name) {
+               if first.AgentId != agentId && !contains(first.SharedWith, 
name) {
                        first.SharedWith = append(first.SharedWith, name)
                }
                return
@@ -105,6 +104,15 @@ func (collected *agentConfigs) add(agentId string, owner 
string, name string, pa
        collected.views = append(collected.views, view)
 }
 
+func contains(names []string, name string) bool {
+       for _, each := range names {
+               if each == name {
+                       return true
+               }
+       }
+       return false
+}
+
 // GetAgentConfigItem returns one skill's manifest or one MCP server's entry.
 func (c *ApiController) GetAgentConfigItem() {
        if c.RequireAdmin() {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to