Code Monkey home page Code Monkey logo

Comments (4)

adamcohen avatar adamcohen commented on June 12, 2024

Same thing happens to me. Would be good to be able to run this tool with absolute file names

from grpcc.

njpatel avatar njpatel commented on June 12, 2024

Have you tried using the --directory option? We added that for situations like this, when you want to specify a working directory outside of your current one. Please re-open if it's still an issue - thanks!

from grpcc.

adamcohen avatar adamcohen commented on June 12, 2024

@njpatel no, --directory doesn't work for me. I have the following setup:

# in ~/.zshrc
$GOPATH=/Users/adam/golang
# in /Users/adam/golang/src/github.com/myrepo/protobuf/myapp/service/myapp_service.proto
import "myapp/service/credentials/credentials.proto";

If I try to use grpcc with the absolute path to the proto, I get:

grpcc -i --proto $GOPATH/src/github.com/myrepo/protobuf/myapp/service/myapp_service.proto --address 127.0.0.1:8020

TypeError: Cannot read property 'ns' of null

If I try to cd to the directory first and then use the relative path, I get:

cd $GOPATH/src; grpcc -i --proto ./github.com/myrepo/protobuf/myapp/service/myapp_service.proto --address 127.0.0.1:8020

Error: failed to import '/Users/adam/golang/src/myapp/service/credentials/credentials.proto' in
  './github.com/myrepo/protobuf/myapp/service/myapp_service.proto': file not found

Which I guess is happening because of the relative path used in import "myapp/service/credentials/credentials.proto", and it's looking for /Users/adam/golang/src/myapp/service/credentials/credentials.proto instead of the correct path which is /Users/adam/golang/src/github.com/myrepo/protobuf/myapp/service/credentials/credentials.proto (the previous path is missing the github.com/myrepo/protobuf)

If I try using --directory, I get:

grpcc -i --proto ./github.com/myrepo/protobuf/myapp/service/myapp_service.proto --address 127.0.0.1:8020 --directory $GOPATH/src/github.com/myrepo/protobuf

TypeError: Cannot read property 'ns' of null

I've tried nearly every permutation of --directory value that I can think of, and they all result in the TypeError message.

from grpcc.

njpatel avatar njpatel commented on June 12, 2024

Bah, that's my fault, the usage of --directory isn't very clear. You can avoid the type error by dropping the full path to your proto (as the look up to your proto is relative to the directory):

grpcc -i --proto ./myapp/service/myapp_service.proto --address 127.0.0.1:8020 --directory $GOPATH/src/github.com/myrepo/protobuf

from grpcc.

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.