You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: http2grpc.go
    path of file: ./repos/go-doudou/cmd/internal/svc/codegen
    
    the code of the file until where you have to start completion: package codegen

import (
	"bytes"
	"github.com/iancoleman/strcase"
	"github.com/sirupsen/logrus"
	"github.com/unionj-cloud/go-doudou/v2/cmd/internal/templates"
	"github.com/unionj-cloud/go-doudou/v2/toolkit/astutils"
	"github.com/unionj-cloud/go-doudou/v2/toolkit/copier"
	"github.com/unionj-cloud/go-doudou/v2/version"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"text/template"
)

var appendHttp2GrpcTmpl = `
{{- range $m := .Meta.Methods }}
	func (receiver *{{$.Meta.Name}}Http2Grpc) {{$m.Name}}(_writer http.ResponseWriter, _req *http.Request) {
    	var (
			{{- range $p := $m.Params }}
			{{- if eq $p.Type "context.Context"}}
			{{ $p.Name }} {{ $p.Type }}
			{{- else }}
			{{$p.Name}} = new({{ trimLeft $p.Type "*" | replacePkg }})
			{{- end }}
			{{- end }}
			{{- range $r := $m.Results }}
			{{- if eq $r.Type "error"}}
			{{ $r.Name }} {{ $r.Type }}
			{{- else }}
			{{ $r.Name }} = new({{ trimLeft $r.Type "*" | replacePkg }})
			{{- end }}
			{{- end }}
		)
		{{- range $p := $m.Params }}
		{{- if eq $p.Type "context.Context" }}
		{{$p.Name}} = _req.Context()
		{{- else if and (eq $m.HttpMethod "GET") (not $.Config.AllowGetWithReqBody)}}
		if _err := _req.ParseForm(); _err != nil {
			rest.PanicBadRequestErr(_err)
		}
		if _err := rest.DecodeForm({{ $p.Name }}, _req.Form); _err != nil {
			rest.PanicBadRequestErr(_err)
		}
		if _err := rest.ValidateStruct({{ $p.Name }}); _err != nil {
			rest.PanicBadRequestErr(_err)
		}
		{{- else }}
		if _err := json.NewDecoder(_req.Body).Decode({{$p.Name}}); _err != nil {
			rest.PanicBadRequestErr(_err)	
		}
		if _err := rest.ValidateStruct({{$p.Name}}); _err != nil {
			rest.PanicBadRequestErr(_err)
		}
		{{- end }}
		{{- end }}
		{{- if eq (len $m.Results) 1 }}
		_, {{ range $i, $r := $m.Results }}{{- $r.Name }}{{- end }} = receiver.{{$.Meta.Name | toLowerCamel}}.{{$m.Name}}Rpc(
		{{- else }}
		{{ r
    
	func (receiver *{{$.Meta.Name}}Http2Grpc) {{$m.Name}}(_writer http.ResponseWriter, _req *http.Request) {
    	var (
			{{- range $p := $m.Params }}
			{{- if eq $p.Type "context.Context"}}
			{{ $p.Name }} {{ $p.Type }}
			{{- else }}
			{{$p.Name}} = new({{ trimLeft $p.Type "*" | replacePkg }})
			{{- end }}
			{{- end }}
			{{- range $r := $m.Results }}
			{{- if eq $r.Type "error"}}
			{{ $r.Name }} {{ $r.Type }}
			{{- else }}
			{{ $r.Name }} = new({{ trimLeft $r.Type "*" | replacePkg }})
			{{- end }}
			{{- end }}
		)
		{{- range $p := $m.Params }}
		{{- if eq $p.Type "context.Context" }}
		{{$p.Name}} = _req.Context()
		{{- else if and (eq $m.HttpMethod "GET") (not $.Config.AllowGetWithReqBody)}}
		if _err := _req.ParseForm(); _err != nil {
			rest.PanicBadRequestErr(_err)
		}
		if _err := rest.DecodeForm({{ $p.Name }}, _req.Form); _err != nil {
			rest.PanicBadRequestErr(_err)
		}
		if _err := rest.ValidateStruct({{ $p.Name }}); _err != nil {
			rest.PanicBadRequestErr(_err)
		}
		{{- else }}
		if _err := json.NewDecoder(_req.Body).Decode({{$p.Name}}); _err != nil {
			rest.PanicBadRequestErr(_err)	
		}
		if _err := rest.ValidateStruct({{$p.Name}}); _err != nil {
			rest.PanicBadRequestErr(_err)
		}
		{{- end }}
		{{- end }}
		{{- if eq (len $m.Results) 1 }}
		_, {{ range $i, $r := $m.Results }}{{- $r.Name }}{{- end }} = receiver.{{$.Meta.Name | toLowerCamel}}.{{$m.Name}}Rpc(
		{{- else }}
		{{ range $i, $r := $m.Results }}{{- if $i}},{{- end}}{{- $r.Name }}{{- end }} = receiver.{{$.Meta.Name | toLowerCamel}}.{{$m.Name}}Rpc(
		{{- end }}
			{{- if eq (len $m.Params) 1 }}
			{{- range $p := $m.Params }}
			{{ $p.Name }},
			{{- end }}
			new(emptypb.Empty),
			{{- else }}
			{{- range $p := $m.Params }}
			{{- if eq $p.Type "context.Context"}}
			{{ $p.Name }},
			{{- else }}
			{{$p.Name}},
			{{- end }}
			{{- end }}
			{{- end }}
		)
		{{- range $r := $m.Results }}
			{{- if eq $r.Type "error" }}
				if {{ $r.Name }} != nil {
					panic({{ $r.Name }})
				}
			{{- end }}
		{{- end }}
		_writer.Header().Set("Content-Type", "application/json; charset=UTF-8")
		{{- if eq (len $m.Results) 1 }}
			if _err := json.NewEncoder(_writer).Encode(struct {}{}); _err != nil {
				rest.HandleInternalServerError(_err)
			}
		{{- else }}
			if _err := json.NewEncoder(_writer).Encode({{- range $r := $m.Results }}{{- if ne $r.Type "error" }}{{- $r.Name }}{{- end }}{{- end }}); _err != nil {
				rest.HandleInternalServerError(_err)
			}
		{{- end }}
    }