fixup imports
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
6b8fa89a69
commit
b002cbb491
23
http.go
23
http.go
@ -30,26 +30,13 @@ func (g *Generator) httpGenerate(component string, plugin *protogen.Plugin) erro
|
||||
gfile.P("// Code generated by protoc-gen-micro")
|
||||
gfile.P("// source: ", *file.Proto.Name)
|
||||
gfile.P("package ", file.GoPackageName)
|
||||
|
||||
gfile.P()
|
||||
gfile.P("import (")
|
||||
gfile.P(`"context"`)
|
||||
gfile.P()
|
||||
gfile.P(`micro_api "github.com/unistack-org/micro/v3/api"`)
|
||||
gfile.P(`micro_client_http "github.com/unistack-org/micro-client-http/v3"`)
|
||||
gfile.P(`micro_client "github.com/unistack-org/micro/v3/client"`)
|
||||
gfile.P(`micro_server "github.com/unistack-org/micro/v3/server"`)
|
||||
gfile.P(")")
|
||||
gfile.P()
|
||||
|
||||
gfile.P("// Reference imports to suppress errors if they are not otherwise used.")
|
||||
gfile.P("var (")
|
||||
gfile.P("_ ", "micro_api.Endpoint")
|
||||
gfile.P("_ ", "context.Context")
|
||||
gfile.P(" _ ", "micro_client.Option")
|
||||
gfile.P(" _ ", "micro_server.Option")
|
||||
gfile.P(")")
|
||||
gfile.P()
|
||||
gfile.Import(contextPackage)
|
||||
gfile.Import(microApiPackage)
|
||||
gfile.Import(microClientPackage)
|
||||
gfile.Import(microClientHttpPackage)
|
||||
gfile.Import(microServerPackage)
|
||||
|
||||
for _, service := range file.Services {
|
||||
generateServiceClient(gfile, service)
|
||||
|
21
rpc.go
21
rpc.go
@ -19,25 +19,12 @@ func (g *Generator) rpcGenerate(component string, plugin *protogen.Plugin) error
|
||||
gfile.P("// Code generated by protoc-gen-micro")
|
||||
gfile.P("// source: ", *file.Proto.Name)
|
||||
gfile.P("package ", file.GoPackageName)
|
||||
|
||||
gfile.P()
|
||||
gfile.P("import (")
|
||||
gfile.P(`"context"`)
|
||||
gfile.P()
|
||||
gfile.P(`micro_api "github.com/unistack-org/micro/v3/api"`)
|
||||
gfile.P(`micro_client "github.com/unistack-org/micro/v3/client"`)
|
||||
gfile.P(`micro_server "github.com/unistack-org/micro/v3/server"`)
|
||||
gfile.P(")")
|
||||
gfile.P()
|
||||
|
||||
gfile.P("// Reference imports to suppress errors if they are not otherwise used.")
|
||||
gfile.P("var (")
|
||||
gfile.P("_ ", "micro_api.Endpoint")
|
||||
gfile.P("_ ", "context.Context")
|
||||
gfile.P(" _ ", "micro_client.Option")
|
||||
gfile.P(" _ ", "micro_server.Option")
|
||||
gfile.P(")")
|
||||
gfile.P()
|
||||
gfile.Import(contextPackage)
|
||||
gfile.Import(microApiPackage)
|
||||
gfile.Import(microClientPackage)
|
||||
gfile.Import(microServerPackage)
|
||||
|
||||
for _, service := range file.Services {
|
||||
generateServiceClient(gfile, service)
|
||||
|
Loading…
x
Reference in New Issue
Block a user