Skip to content

Commit

Permalink
feat: upgrade gotils dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio Andres Virviescas Santana committed Sep 8, 2021
1 parent ffafa7e commit aa309d5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/fasthttp/router
go 1.15

require (
github.com/savsgio/gotils v0.0.0-20210617111740-97865ed5a873
github.com/savsgio/gotils v0.0.0-20210907153846-c06938798b52
github.com/valyala/bytebufferpool v1.0.0
github.com/valyala/fasthttp v1.29.0
)
6 changes: 3 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
github.com/andybalholm/brotli v1.0.2 h1:JKnhI/XQ75uFBTiuzXpzFrUriDPiZjlOSzh6wXogP0E=
github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/klauspost/compress v1.13.4 h1:0zhec2I8zGnjWcKyLl6i3gPqKANCCn5e9xmviEEeX6s=
github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
github.com/savsgio/gotils v0.0.0-20210617111740-97865ed5a873 h1:N3Af8f13ooDKcIhsmFT7Z05CStZWu4C7Md0uDEy4q6o=
github.com/savsgio/gotils v0.0.0-20210617111740-97865ed5a873/go.mod h1:dmPawKuiAeG/aFYVs2i+Dyosoo7FNcm+Pi8iK6ZUrX8=
github.com/savsgio/gotils v0.0.0-20210907153846-c06938798b52 h1:FODZE/jDkENIpW3JiMA9sXBQfNklTfClUNhR9k37dPY=
github.com/savsgio/gotils v0.0.0-20210907153846-c06938798b52/go.mod h1:oejLrk1Y/5zOF+c/aHtXqn3TFlzzbAgPWg8zBiAHDas=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.29.0 h1:F5GKpytwFk5OhCuRh6H+d4vZAcEeNAwPTdwQnm6IERY=
Expand Down
7 changes: 4 additions & 3 deletions radix/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"sort"
"strings"

gstrings "github.com/savsgio/gotils/strings"
"github.com/valyala/bytebufferpool"
"github.com/valyala/fasthttp"
)
Expand Down Expand Up @@ -95,7 +96,7 @@ func (n *node) findEndIndexAndValues(path string) (int, []string) {
continue
}

values[i] = copyString(path[index[j-1]:index[j]])
values[i] = gstrings.Copy(path[index[j-1]:index[j]])

i++
}
Expand Down Expand Up @@ -312,7 +313,7 @@ func (n *node) getFromChild(path string, ctx *fasthttp.RequestCtx) (fasthttp.Req

case param:
end := segmentEndIndex(path, false)
values := []string{copyString(path[:end])}
values := []string{gstrings.Copy(path[:end])}

if child.paramRegex != nil {
end, values = child.findEndIndexAndValues(path[:end])
Expand Down Expand Up @@ -358,7 +359,7 @@ func (n *node) getFromChild(path string, ctx *fasthttp.RequestCtx) (fasthttp.Req

if n.wildcard != nil {
if ctx != nil {
ctx.SetUserValue(n.wildcard.paramKey, copyString(path))
ctx.SetUserValue(n.wildcard.paramKey, gstrings.Copy(path))
}

return n.wildcard.handler, false
Expand Down
5 changes: 0 additions & 5 deletions radix/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"strings"
"unicode/utf8"

"github.com/savsgio/gotils/strconv"
"github.com/valyala/bytebufferpool"
)

Expand Down Expand Up @@ -170,7 +169,3 @@ func findWildPath(path string, fullPath string) *wildPath {

return nil
}

func copyString(a string) string {
return string(strconv.S2B(a))
}
10 changes: 0 additions & 10 deletions radix/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,3 @@ func Test_findWildPathConflict(t *testing.T) {
}
}
}

func Test_copyString(t *testing.T) {
s := "some string"

result := copyString(s)

if result != s {
t.Errorf("copyString() == %s, want %s", result, s)
}
}

0 comments on commit aa309d5

Please sign in to comment.