Giter VIP home page Giter VIP logo

Comments (5)

johanbrandhorst avatar johanbrandhorst commented on June 1, 2024

Hi! Thanks for raising an issue. Could you show me the .proto file you used and the protoc command used? This doesn't look like it should be happening.

from protobuf.

mwei0210 avatar mwei0210 commented on June 1, 2024

Hi @johanbrandhorst , this would generate an instance of import google_protobuf "google/protobuf"

syntax = "proto3";

package account;

import "google/protobuf/any.proto";

message Account {
    google.protobuf.Any metadata = 1;
}

from protobuf.

johanbrandhorst avatar johanbrandhorst commented on June 1, 2024

Yeah so I suspect you're not using the correct type replacing 😬. If you take a look at the example repo you can see that you'll need to use the -M parameter to get the correct imports in the resulting file when using a Google Protobuf Well Known Type (such as any.proto or timestamp.proto):

https://github.com/johanbrandhorst/grpcweb-example/blob/master/Makefile#L4

protoc -I. -Ivendor/ proto/library/book_service.proto \
    	--gopherjs_out=plugins=grpc,Mgoogle/protobuf/timestamp.proto=github.com/johanbrandhorst/protobuf/ptypes/timestamp:$$GOPATH/src \
    	--go_out=plugins=grpc:$$GOPATH/src

If you try using --gopherjs_out=plugins=grpc,Mgoogle/protobuf/any.proto=github.com/johanbrandhorst/protobuf/ptypes/any, it should work :). Let me know how it goes!

from protobuf.

mwei0210 avatar mwei0210 commented on June 1, 2024

ah it works now thanks! Is there anyway to automate it?

from protobuf.

johanbrandhorst avatar johanbrandhorst commented on June 1, 2024

Unfortunately this M-parameter always has to be supplied to protoc since the source file you're using declares option go_package = github.com/golang/protobuf/ptypes/any. Glad it fixed your use case though!

from protobuf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.