refactor: run Go modernize (#5002)

This commit is contained in:
Maximilian
2026-02-08 08:57:30 -06:00
committed by GitHub
parent 408aa78ed5
commit a704e86ac1
102 changed files with 322 additions and 352 deletions
+5 -11
View File
@@ -1,5 +1,7 @@
package plugins
import "slices"
// Capability represents a plugin capability type.
// Capabilities are detected by checking which functions a plugin exports.
type Capability string
@@ -25,11 +27,8 @@ func detectCapabilities(plugin functionExistsChecker) []Capability {
var capabilities []Capability
for cap, functions := range capabilityFunctions {
for _, fn := range functions {
if plugin.FunctionExists(fn) {
capabilities = append(capabilities, cap)
break // Found at least one function, plugin has this capability
}
if slices.ContainsFunc(functions, plugin.FunctionExists) {
capabilities = append(capabilities, cap) // Found at least one function, plugin has this capability
}
}
@@ -38,10 +37,5 @@ func detectCapabilities(plugin functionExistsChecker) []Capability {
// hasCapability checks if the given capabilities slice contains a specific capability.
func hasCapability(capabilities []Capability, cap Capability) bool {
for _, c := range capabilities {
if c == cap {
return true
}
}
return false
return slices.Contains(capabilities, cap)
}