Skip to content

Commit

Permalink
replace for loop by sort.SearchStrings
Browse files Browse the repository at this point in the history
  • Loading branch information
imjaroiswebdev committed Feb 28, 2024
1 parent 15c1f35 commit 80b1128
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"math"
"reflect"
"regexp"
"sort"
"strings"
"time"
"unicode"
Expand Down Expand Up @@ -282,11 +283,9 @@ func ValidateTZValueDiagFunc(v interface{}, p cty.Path) diag.Diagnostics {

value := v.(string)
valid := false
for _, tz := range validTZ {
if value == tz {
valid = true
break
}

if sort.SearchStrings(validTZ, value) < len(validTZ) {
valid = true
}

if !valid {
Expand Down

0 comments on commit 80b1128

Please sign in to comment.