chore: update linter

This commit is contained in:
Ludovic Fernandez 2024-02-19 15:44:03 +01:00 committed by GitHub
parent 1034646ae2
commit 88a2020817
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
57 changed files with 139 additions and 218 deletions

View file

@ -6,6 +6,7 @@ import (
"fmt"
"net"
"regexp"
"slices"
"sort"
"strconv"
"strings"
@ -301,15 +302,9 @@ func alpn(tree *matchersTree, protos ...string) error {
}
tree.matcher = func(meta ConnData) bool {
for _, proto := range meta.alpnProtos {
for _, filter := range protos {
if proto == filter {
return true
}
}
}
return false
return slices.ContainsFunc(meta.alpnProtos, func(proto string) bool {
return slices.Contains(protos, proto)
})
}
return nil
@ -469,7 +464,7 @@ func varGroupName(idx int) string {
func braceIndices(s string) ([]int, error) {
var level, idx int
var idxs []int
for i := 0; i < len(s); i++ {
for i := range len(s) {
switch s[i] {
case '{':
if level++; level == 1 {