openconfig / ygot

A YANG-centric Go toolkit - Go/Protobuf Code Generation; Validation; Marshaling/Unmarshaling
Apache License 2.0
286 stars 107 forks source link

no input modules specified - Protobuf #273

Closed mbk closed 5 years ago

mbk commented 5 years ago

I think this actually is a documentation issue as things have shuffled around a bit, but I can't seem to get things working.......

I keep getting the $subject as error if I follow:

https://github.com/openconfig/ygot/blob/master/docs/protobuf_getting_started.md , section "Generating openconfig-bgp-rib Protobufs".

I noticed things have moved around a bit, my command is:

go run github.com/openconfig/ygot/proto_generator/protogenerator.go   -generate_fakeroot   -base_import_path="<fully qualified path here>/golang/src/github.com/openconfig/ygot/demo/protobuf_getting_started/ribproto"   -path=yang -output_dir=ribproto   -package_name=openconfig -enum_package_name=enums

Any thoughts or inputs would be highly appreciated. My end-goal is to go from a Yang file to Protobuf.

mbk commented 5 years ago

For example, this fails:

go run github.com/openconfig/ygot/proto_generator/protogenerator.go   -generate_fakeroot   -base_import_path="https://github.com/openconfig/ygot/demo/protobuf_getting_started/ribproto"   -path=yang -output_dir=ribproto   -package_name=openconfig -enum_package_name=enums
mbk commented 5 years ago

go get -u github.com/openconfig/ygot also seems to fail now:

package github.com/openconfig/ygot: no Go files in /Users/makoopma/go/src/github.com/openconfig/ygot

Ironically , that location is not in my GOPATH - it's the value of GOROOT though. And there everything can be found. None of the examples (with updated paths) work from my $GOPATH workspace though.

robshakir commented 5 years ago

Sorry -- missed this issue.

The "error" with go get is just a warning, this is because the repo contains multiple packages, and the base dir of the repo doesn't have any Go files in it. It's non-fatal.

The command used as part of CI to generate protos is:

go run ../../proto_generator/protogenerator.go \
  -generate_fakeroot \
  -base_import_path="github.com/openconfig/ygot/demo/protobuf_getting_started/ribproto" \
  -path=yang -output_dir=ribproto \
  -enum_package_name=enums -package_name=openconfig \
  -exclude_modules=ietf-interfaces \
  yang/rib/openconfig-rib-bgp.yang

This works on my system. It'd be very useful to see what the error actually is when you say it fails.

Thanks, r.