Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some other imports not existing #43

Closed
Raffo opened this issue Jan 10, 2018 · 4 comments
Closed

Some other imports not existing #43

Raffo opened this issue Jan 10, 2018 · 4 comments

Comments

@Raffo
Copy link
Contributor

Raffo commented Jan 10, 2018

Sorry to bother again, but there is another issue.
I get this error when I try to build a main:

# test/foo/transport/converter/protobuf
transport/converter/protobuf/endpoint_converters.go:13:10: undefined: proto_utils.UppercaseRequest
transport/converter/protobuf/endpoint_converters.go:18:10: undefined: proto_utils.CountRequest
transport/converter/protobuf/endpoint_converters.go:26:10: undefined: proto_utils.UppercaseResponse
transport/converter/protobuf/endpoint_converters.go:35:10: undefined: proto_utils.CountResponse
transport/converter/protobuf/endpoint_converters.go:42:19: undefined: proto_utils.UppercaseRequest
transport/converter/protobuf/endpoint_converters.go:47:19: undefined: proto_utils.CountRequest
transport/converter/protobuf/endpoint_converters.go:55:21: undefined: proto_utils.UppercaseResponse
transport/converter/protobuf/endpoint_converters.go:60:21: undefined: proto_utils.CountResponse

This is the part of code that is failing:

import (
	context "context"
	foo "test/foo"

	protoutils "github.com/devimteam/proto-utils"
)

func EncodeUppercaseRequest(_ context.Context, request interface{}) (interface{}, error) {
	req := request.(*foo.UppercaseRequest)
	return &protoutils.UppercaseRequest{Str: req.Str}, nil
}

The progress might be in github.com/devimteam/proto-utils but I report it here because it could just be the way it is used.

@vetcher
Copy link
Contributor

vetcher commented Jan 10, 2018

@Raffo Could you paste your interface here? Default example in ./example/generated is not using github.com/devimteam/proto-utils, as well as microgen itself.

@Raffo
Copy link
Contributor Author

Raffo commented Jan 10, 2018

Sure, here it is:

package stringsvc

import (
	"context"
)

// @microgen http, grpc, middleware, logging, recover, main
// @protobuf github.com/devimteam/proto-utils
// @grpc-addr test.address
type StringService interface {
	Uppercase(ctx context.Context, str string) (ans string, err error)
	Count(ctx context.Context, text string, symbol string) (count int, positions []int, err error)
}

// Generated by "microgen" tool.
// Struct stringService implements StringService interface.
type stringService struct {
}

func NewStringService() StringService {
	panic("constructor not provided")
}

func (S *stringService) Uppercase(ctx context.Context, str string) (ans string, err error) {
	panic("method not provided")
}

func (S *stringService) Count(ctx context.Context, text string, symbol string) (count int, positions []int, err error) {
	panic("method not provided")
}

I actually copy-pasted from the README.md and added and error as last parameter to "make it work" .

@vetcher
Copy link
Contributor

vetcher commented Jan 10, 2018

Oh, I understand. Please, use this code, I need to fix readme.

package stringsvc

import (
	"context"

	"github.com/devimteam/microgen/example/svc/entity"
)

// @microgen middleware, logging, grpc, http, recover, main
// @grpc-addr service.string
// @protobuf github.com/devimteam/microgen/example/protobuf
type StringService interface {
	// @logs-ignore ans, err
	Uppercase(ctx context.Context, stringsMap map[string]string) (ans string, err error)
	Count(ctx context.Context, text string, symbol string) (count int, positions []int, err error)
	// @logs-len comments
	TestCase(ctx context.Context, comments []*entity.Comment) (tree map[string]int, err error)
}

@Raffo
Copy link
Contributor Author

Raffo commented Jan 10, 2018

That's cool thanks! I guess you can open another issue or use this one to keep track of fixing the readme :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants