From 46d4461f6d9904aee7c9b2aa8c5133afe9e42520 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Tue, 3 Aug 2021 00:19:53 +0300 Subject: [PATCH] util/router: sync from github Signed-off-by: Vasiliy Tolstov --- util/router/compile_test.go | 2 +- util/router/parse.go | 3 --- util/router/parse_test.go | 9 --------- util/router/runtime.go | 13 ++++++------- 4 files changed, 7 insertions(+), 20 deletions(-) diff --git a/util/router/compile_test.go b/util/router/compile_test.go index 17caa000..63afe625 100644 --- a/util/router/compile_test.go +++ b/util/router/compile_test.go @@ -25,7 +25,7 @@ func TestCompile(t *testing.T) { segs: []segment{ literal(eof), }, - ops: []int{int(utilities.OpLitPush), 0}, + ops: []int{int(OpLitPush), 0}, pool: []string{""}, }, { diff --git a/util/router/parse.go b/util/router/parse.go index 99132371..846ba0d1 100644 --- a/util/router/parse.go +++ b/util/router/parse.go @@ -3,11 +3,8 @@ package router // download from https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/protoc-gen-grpc-gateway/httprule/parse.go import ( - "context" "fmt" "strings" - - "github.com/unistack-org/micro/v3/logger" ) // InvalidTemplateError indicates that the path template is not valid. diff --git a/util/router/parse_test.go b/util/router/parse_test.go index 5b65208d..fb13b444 100644 --- a/util/router/parse_test.go +++ b/util/router/parse_test.go @@ -4,7 +4,6 @@ package router import ( "context" - "flag" "fmt" "reflect" "testing" @@ -135,10 +134,6 @@ func TestTokenize(t *testing.T) { } func TestParseSegments(t *testing.T) { - err := flag.Set("v", "3") - if err != nil { - t.Fatalf("failed to set flag: %v", err) - } for _, spec := range []struct { tokens []string want []segment @@ -298,10 +293,6 @@ func TestParseSegments(t *testing.T) { } func TestParseSegmentsWithErrors(t *testing.T) { - err := flag.Set("v", "3") - if err != nil { - t.Fatalf("failed to set flag: %v", err) - } for _, spec := range []struct { tokens []string }{ diff --git a/util/router/runtime.go b/util/router/runtime.go index bd8cf747..54d15f71 100644 --- a/util/router/runtime.go +++ b/util/router/runtime.go @@ -143,13 +143,12 @@ func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, er typedOps = append(typedOps, op) } return Pattern{ - ops: typedOps, - pool: pool, - vars: vars, - stacksize: maxstack, - tailLen: tailLen, - verb: verb, - assumeColonVerb: options.assumeColonVerb, + ops: typedOps, + pool: pool, + vars: vars, + stacksize: maxstack, + tailLen: tailLen, + verb: verb, }, nil }