mattermost-community-enterp.../vendor/github.com/splitio/go-toolkit/v5/common/sliceutil.go
Claude ec1f89217a Merge: Complete Mattermost Server with Community Enterprise
Full Mattermost server source with integrated Community Enterprise features.
Includes vendor directory for offline/air-gapped builds.

Structure:
- enterprise-impl/: Enterprise feature implementations
- enterprise-community/: Init files that register implementations
- enterprise/: Bridge imports (community_imports.go)
- vendor/: All dependencies for offline builds

Build (online):
  go build ./cmd/mattermost

Build (offline/air-gapped):
  go build -mod=vendor ./cmd/mattermost

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 23:59:07 +09:00

34 lines
689 B
Go

package common
// Partition create partitions considering the passed amount
func Partition(items []string, maxItems int) [][]string {
var splitted [][]string
for i := 0; i < len(items); i += maxItems {
end := i + maxItems
if end > len(items) {
end = len(items)
}
splitted = append(splitted, items[i:end])
}
return splitted
}
// DedupeStringSlice returns a new slice without duplicate strings
func DedupeStringSlice(items []string) []string {
present := make(map[string]struct{}, len(items))
for idx := range items {
present[items[idx]] = struct{}{}
}
ret := make([]string, 0, len(present))
for key := range present {
ret = append(ret, key)
}
return ret
}