1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-24 03:16:14 +02:00

remove some unused code (#2116)

* remove unused code
This commit is contained in:
eric 2022-03-13 21:31:39 +08:00 committed by GitHub
parent 3f5b733425
commit 54efc3850d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 32 deletions

View File

@ -54,7 +54,7 @@ func TestBindingError_Error(t *testing.T) {
func TestBindingError_ErrorJSON(t *testing.T) {
err := NewBindingError("id", []string{"1", "nope"}, "bind failed", errors.New("internal error"))
resp, err := json.Marshal(err)
resp, _ := json.Marshal(err)
assert.Equal(t, `{"field":"id","message":"bind failed"}`, string(resp))
}

View File

@ -1,7 +1,6 @@
package echo
import (
"fmt"
"net/http"
"net/http/httptest"
"strings"
@ -2446,33 +2445,3 @@ func BenchmarkRouterGooglePlusAPIMisses(b *testing.B) {
func BenchmarkRouterParamsAndAnyAPI(b *testing.B) {
benchmarkRouterRoutes(b, paramAndAnyAPI, paramAndAnyAPIToFind)
}
func (n *node) printTree(pfx string, tail bool) {
p := prefix(tail, pfx, "└── ", "├── ")
fmt.Printf("%s%s, %p: type=%d, parent=%p, handler=%v, pnames=%v\n", p, n.prefix, n, n.kind, n.parent, n.methodHandler, n.pnames)
p = prefix(tail, pfx, " ", "│ ")
children := n.staticChildren
l := len(children)
if n.paramChild != nil {
n.paramChild.printTree(p, n.anyChild == nil && l == 0)
}
if n.anyChild != nil {
n.anyChild.printTree(p, l == 0)
}
for i := 0; i < l-1; i++ {
children[i].printTree(p, false)
}
if l > 0 {
children[l-1].printTree(p, true)
}
}
func prefix(tail bool, p, on, off string) string {
if tail {
return fmt.Sprintf("%s%s", p, on)
}
return fmt.Sprintf("%s%s", p, off)
}