Closed nogolang closed 1 month ago
this is my build
func WireApp() *conf.GrpcServer { wire.Build( wire.Struct(new(conf.GrpcServer), "*"), conf.NewGrpc, conf.ZapProvider, conf.GormProvider, service.ProviderSet, ) return &conf.GrpcServer{} }
this is NewGrpc
func NewGrpc(logger *zap.Logger) *grpc.Server { svc := grpc.NewServer() loadMiddleware(logger, svc) return svc }
gen grpcServer happen invalid type, why?
func WireApp() *conf.GrpcServer { logger := conf.NewZapConfig() invalid type := conf.NewGrpc(logger) grpcServer := &conf.GrpcServer{ Grpc: invalid type, } return grpcServer }
error info
wire: 20:10: expected ';', found 'type' (and 3 more errors) wire: grpc-layout/cmd: generate failed wire: grpc-layout/cmd: wrote D:\program\3-项目\1-基础架构\2-go架构\2-grpc架构\cmd\wire_gen.go wire: at least one generate failure
the problem is fix , i don't know why,i refresh the wire import in go mod,then it's work ,it's very weird
this is my build
this is NewGrpc
gen grpcServer happen invalid type, why?
error info