aboutsummaryrefslogtreecommitdiffstats
path: root/models/unit/unit.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/unit/unit.go')
-rw-r--r--models/unit/unit.go15
1 files changed, 3 insertions, 12 deletions
diff --git a/models/unit/unit.go b/models/unit/unit.go
index 4ca676802f..c0560678ca 100644
--- a/models/unit/unit.go
+++ b/models/unit/unit.go
@@ -6,6 +6,7 @@ package unit
import (
"errors"
"fmt"
+ "slices"
"strings"
"sync/atomic"
@@ -204,22 +205,12 @@ func LoadUnitConfig() error {
// UnitGlobalDisabled checks if unit type is global disabled
func (u Type) UnitGlobalDisabled() bool {
- for _, ud := range DisabledRepoUnitsGet() {
- if u == ud {
- return true
- }
- }
- return false
+ return slices.Contains(DisabledRepoUnitsGet(), u)
}
// CanBeDefault checks if the unit type can be a default repo unit
func (u *Type) CanBeDefault() bool {
- for _, nadU := range NotAllowedDefaultRepoUnits {
- if *u == nadU {
- return false
- }
- }
- return true
+ return !slices.Contains(NotAllowedDefaultRepoUnits, *u)
}
// Unit is a section of one repository