refactor: replace bool map with set-style map for internal channels (#472)

* refactor: replace bool map with set-style map for internal channels

Use map[string]struct{} and comma-ok idiom for clearer and more idiomatic membership checks.

* Update pkg/constants/channels.go

Co-authored-by: Harsh Bansal <122075346+harshbansal7@users.noreply.github.com>

---------

Co-authored-by: Harsh Bansal <122075346+harshbansal7@users.noreply.github.com>
This commit is contained in:
Ruslan Semagin 2026-02-19 13:48:17 +03:00 committed by GitHub
parent 56a060ff61
commit 32c5c4b3a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,15 +1,16 @@
// Package constants provides shared constants across the codebase. // Package constants provides shared constants across the codebase.
package constants package constants
// InternalChannels defines channels that are used for internal communication // internalChannels defines channels that are used for internal communication
// and should not be exposed to external users or recorded as last active channel. // and should not be exposed to external users or recorded as last active channel.
var InternalChannels = map[string]bool{ var internalChannels = map[string]struct{}{
"cli": true, "cli": {},
"system": true, "system": {},
"subagent": true, "subagent": {},
} }
// IsInternalChannel returns true if the channel is an internal channel. // IsInternalChannel returns true if the channel is an internal channel.
func IsInternalChannel(channel string) bool { func IsInternalChannel(channel string) bool {
return InternalChannels[channel] _, found := internalChannels[channel]
return found
} }