1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-18 22:17:44 +02:00

fix: easy lint fixes to api/ (#2567)

This commit is contained in:
Rene Jochum
2022-10-01 10:50:11 +02:00
committed by GitHub
parent 010b1d9f11
commit 065f9714e9
23 changed files with 380 additions and 165 deletions

View File

@ -1,6 +1,7 @@
package util
// download from https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/protoc-gen-grpc-gateway/httprule/compile.go
// download from
// https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/protoc-gen-grpc-gateway/httprule/compile.go
const (
opcodeVersion = 1
@ -66,6 +67,7 @@ func (v variable) compile() []op {
for _, s := range v.segments {
ops = append(ops, s.compile()...)
}
ops = append(ops, op{
code: OpConcatN,
operand: len(v.segments),
@ -88,7 +90,9 @@ func (t template) Compile() Template {
pool []string
fields []string
)
consts := make(map[string]int)
for _, op := range rawOps {
ops = append(ops, int(op.code))
if op.str == "" {
@ -100,10 +104,12 @@ func (t template) Compile() Template {
}
ops = append(ops, consts[op.str])
}
if op.code == OpCapture {
fields = append(fields, op.str)
}
}
return Template{
Version: opcodeVersion,
OpCodes: ops,