Skip to content

Commit

Permalink
remove some unused code (#2116)
Browse files Browse the repository at this point in the history
* remove unused code
  • Loading branch information
nonbutAworker committed Mar 13, 2022
1 parent 3f5b733 commit 54efc38
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
2 changes: 1 addition & 1 deletion binder_test.go
Expand Up @@ -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))
}
Expand Down
31 changes: 0 additions & 31 deletions router_test.go
@@ -1,7 +1,6 @@
package echo

import (
"fmt"
"net/http"
"net/http/httptest"
"strings"
Expand Down Expand Up @@ -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)
}

0 comments on commit 54efc38

Please sign in to comment.