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

generated code incorrectly refers to $util instead of util #732

Closed
tamird opened this Issue Mar 27, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@tamird

tamird commented Mar 27, 2017

In CockroachDB we have some protos in the util package, but the protobufjs generated code trips on this and generates code like this:

            UnresolvedAddr.decode = function decode(reader, length) {
                if (!(reader instanceof $Reader))
                    reader = $Reader.create(reader);
                let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cockroach.$util.UnresolvedAddr();
                while (reader.pos < end) {
                    let tag = reader.uint32();
                    switch (tag >>> 3) {
                    case 1:
                        message.network_field = reader.string();
                        break;
                    case 2:
                        message.address_field = reader.string();
                        break;
                    default:
                        reader.skipType(tag & 7);
                        break;
                    }
                }
                return message;
            };

Note that $root.cockroach.$util should be $root.cockroach.util.

dcodeIO added a commit that referenced this issue Mar 27, 2017

@dcodeIO

This comment has been minimized.

Owner

dcodeIO commented Mar 27, 2017

Got a bit lost in espree's AST so please let me know if this fixes your issue(s). Might affect the PR.

@tamird

This comment has been minimized.

tamird commented Mar 27, 2017

Fixes my issue, hurray! Rebased the PR as well.

@tamird tamird closed this Mar 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment